diff --git a/.java-version b/.java-version index 2cb7d300212..6259340971b 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -oracle64-1.8.0.152 \ No newline at end of file +1.8 diff --git a/.travis.yml b/.travis.yml index 5d790284751..f47f448b874 100644 --- a/.travis.yml +++ b/.travis.yml @@ -131,6 +131,12 @@ script: # WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet. - mvn --quiet --batch-mode --show-version clean install - mvn --quiet --batch-mode --show-version verify -Psamples + # test maven plugin + - mvn clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml + - mvn clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml + # test gradle plugin + - (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk) + - (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate) after_success: # push to maven repo - if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 9b780d2f195..417f34349f2 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -12,6 +12,15 @@ if [ "$NODE_INDEX" = "1" ]; then #cp CI/pom.xml.circleci pom.xml java -version mvn --quiet verify -Psamples.circleci + + # generate all petstore samples (client, servers, doc) + ./bin/run-all-petstore + # generate all petstore samples (openapi3) + ./bin/openapi3/run-all-petstore + # generate test scripts + ./bin/tests/run-all-test + # test all generators with fake petstore spec (2.0, 3.0) + ./bin/utils/test-fake-petstore-for-all.sh elif [ "$NODE_INDEX" = "2" ]; then # run ensure-up-to-date sample script on SNAPSHOT version only project_version=`mvn org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout` diff --git a/CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index e510bba3f59..c7a19d07a9f 100644 --- a/CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -47,16 +47,16 @@ OpenAPI spec version: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -65,10 +65,10 @@ OpenAPI spec version: 1.0.0 ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll diff --git a/README.md b/README.md index a079e9c6014..8ea13ee6e4e 100644 --- a/README.md +++ b/README.md @@ -2,15 +2,15 @@
-[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.0.1`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) +[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`4.0.3`): [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/master.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=master)](https://app.shippable.com/github/OpenAPITools/openapi-generator) [![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=master&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) -[`4.1.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.0.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) -[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) -[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.0.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) -[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=4.0.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) +[`4.1.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.1.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.1.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) +[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.1.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) +[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.1.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) +[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=4.1.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) [`5.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/5.0.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/5.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/5.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) @@ -99,8 +99,8 @@ OpenAPI Generator Version | Release Date | Notes ---------------------------- | ------------ | ----- 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback) 4.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/)| 15.07.2019 | Minor release (breaking changes with fallbacks) -4.0.2 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.1-SNAPSHOT/)| 15.06.2019 | Patch release (minor bug fixes, etc) -[4.0.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.1) (latest stable release) | 31.05.2019 | Patch release (bug fixes, minor enhancements, etc) +4.0.3 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.3-SNAPSHOT/)| 04.07.2019 | Patch release (minor bug fixes, etc) +[4.0.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.2) (latest stable release) | 20.06.2019 | Patch release (bug fixes, minor enhancements, etc) OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 @@ -153,19 +153,19 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository. * [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc) ### [1.3 - Download JAR](#table-of-contents) - + If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum): -JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.1/openapi-generator-cli-4.0.1.jar` +JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar` For **Mac/Linux** users: ```sh -wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.1/openapi-generator-cli-4.0.1.jar -O openapi-generator-cli.jar +wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar -O openapi-generator-cli.jar ``` For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g. ``` -Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.1/openapi-generator-cli-4.0.1.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -175,7 +175,7 @@ For Mac users, please make sure Java 8 is installed (Tips: run `java -version` t export JAVA_HOME=`/usr/libexec/java_home -v 1.8` export PATH=${JAVA_HOME}/bin:$PATH ``` - + ### Launcher Script One downside to manual jar downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at [bin/utils/openapi-generator.cli.sh](./bin/utils/openapi-generator-cli.sh) which resolves this issue. @@ -368,10 +368,11 @@ npm install @openapitools/openapi-generator-cli -g openapi-generator version ``` -Or install a particualar OpenAPI Generator version (e.g. v4.0.1): + +Or install a particular OpenAPI Generator version (e.g. v4.0.2): ```sh -npm install @openapitools/openapi-generator-cli@cli-4.0.1 -g +npm install @openapitools/openapi-generator-cli@cli-4.0.2 -g ``` Or install it as dev-dependency: @@ -379,7 +380,7 @@ Or install it as dev-dependency: ```sh npm install @openapitools/openapi-generator-cli -D ``` - + ## [2 - Getting Started](#table-of-contents) To generate a PHP client for [petstore.yaml](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml), please run the following @@ -394,7 +395,9 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat ``` (if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`) -You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.1/openapi-generator-cli-4.0.1.jar) + +You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar) + To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate` @@ -536,6 +539,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [codecentric AG](https://www.codecentric.de/) - [Cupix](https://www.cupix.com/) - [FormAPI](https://formapi.io/) +- [Fuse](https://www.fuse.no/) - [GenFlow](https://github.com/RepreZen/GenFlow) - [GMO Pepabo](https://pepabo.com/en/) - [GoDaddy](https://godaddy.com) @@ -590,7 +594,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2019-05-01 - [Design and generate a REST API from Swagger / OpenAPI in Java, Python, C# and more](https://simply-how.com/design-and-generate-api-code-from-openapi) by [Simply How](https://simply-how.com/) - 2019-05-17 - [Generate Spring Boot REST API using Swagger/OpenAPI](https://www.47northlabs.com/knowledge-base/generate-spring-boot-rest-api-using-swagger-openapi/) by [Antonie Zafirov](https://www.47northlabs.com/author/antonie-zafirov/) - 2019-05-22 - [REST APIs代码生成指南(OpenAPI Generator)](https://gum.co/openapi_generator_ebook_gb) by [William Cheng](https://twitter.com/wing328), [Xin Meng](https://github.com/xmeng1) -- 2019-05/24 - [REST API 代碼生成指南 (OpenAPI Generator)](https://gum.co/openapi_generator_ebook_big5) by [William Cheng](https://twitter.com/wing328) +- 2019-05-24 - [REST API 代碼生成指南 (OpenAPI Generator)](https://gum.co/openapi_generator_ebook_big5) by [William Cheng](https://twitter.com/wing328) +- 2019-06-24 - [Kubernetes Clients and OpenAPI Generator](https://speakerdeck.com/wing328/kubernetes-clients-and-openapi-generator) by [William Cheng](https://twitter.com/wing328) at [Kubernetes Contributor Summits Shanghai 2019](https://www.lfasiallc.com/events/contributors-summit-china-2019/) ## [6 - About Us](#table-of-contents) @@ -603,7 +608,8 @@ OpenAPI Generator core team members are contributors who have been making signif * [@jimschubert](https://github.com/jimschubert) (2016/05) [:heart:](https://www.patreon.com/jimschubert) * [@cbornet](https://github.com/cbornet) (2016/05) * [@ackintosh](https://github.com/ackintosh) (2018/02) [:heart:](https://www.patreon.com/ackintosh/overview) -* [@jmini](https://github.com/jmini) (2018/04) +* [@jmini](https://github.com/jmini) (2018/04) [:heart:](https://www.patreon.com/jmini) +* [@etherealjoy](https://github.com/etherealjoy) (2019/06) :heart: = Link to support the contributor directly @@ -774,7 +780,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Lua | @daurnimator (2017/08) | | NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) | | ObjC | | -| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) | +| Perl | @wing328 (2017/07) [:heart:](https://www.patreon.com/wing328) @yue9944882 (2019/06) | | PHP | @jebentier (2017/07), @dkarlovi (2017/07), @mandrean (2017/08), @jfastnacht (2017/09), @ackintosh (2017/09) [:heart:](https://www.patreon.com/ackintosh/overview), @ybelenko (2018/07), @renepardon (2018/12) | | PowerShell | | | Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) | @@ -811,7 +817,7 @@ OpenAPI Generator is a fork of [Swagger Codegen](https://github.com/swagger-api/ - [Jean-François Côté](https://github.com/JFCote) - [Jim Schubert](https://github.com/jimschubert) - [Jon Schoning](https://github.com/jonschoning) -- [Jérémie Bresson](https://github.com/jmini) +- [Jérémie Bresson](https://github.com/jmini) [:heart:](https://www.patreon.com/jmini) - [Jörn Ahrens](https://github.com/jayearn) - [Keni Steward](https://github.com/kenisteward) - [Marcin Stefaniuk](https://github.com/mstefaniuk) diff --git a/appveyor.yml b/appveyor.yml index 4b387578e8f..afafbd2e704 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -50,7 +50,7 @@ build_script: # install openapi-generator locally - mvn clean install --quiet # run the locally installed openapi-generator-gradle-plugin - - gradle -PopenApiGeneratorVersion=4.0.2-SNAPSHOT -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --info + - gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --info test_script: # restore test-related files - copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj @@ -58,9 +58,9 @@ test_script: - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj - dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj # test c# API client - - nunit-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor + - nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor # test c# API client (with PropertyChanged) - - nunit-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor + - nunit3-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor # generate all petstore clients - .\bin\windows\run-all-petstore.cmd diff --git a/bin/ada-petstore.sh b/bin/ada-petstore.sh index 87005f0ee1b..5441bd13ec3 100755 --- a/bin/ada-petstore.sh +++ b/bin/ada-petstore.sh @@ -30,7 +30,7 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" model="modules/openapi-generator/src/test/resources/2_0/petstore.yaml" ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -g ada $@" ags="$ags -i $model -t modules/openapi-generator/src/main/resources/Ada -o samples/client/petstore/ada" -ags="$ags -DprojectName=Petstore --model-package Samples.Petstore" +ags="$ags --additional-properties projectName=Petstore --model-package Samples.Petstore" java $JAVA_OPTS -jar $executable $ags rm -rf samples/client/petstore/ada/src/server diff --git a/bin/android-petstore-httpclient.sh b/bin/android-petstore-httpclient.sh index c2e03a737fa..d0982cec14f 100755 --- a/bin/android-petstore-httpclient.sh +++ b/bin/android-petstore-httpclient.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@" +ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/cpp-restsdk-petstore.sh b/bin/cpp-restsdk-petstore.sh index 1c5f0ad54e5..ad9090d0b5c 100755 --- a/bin/cpp-restsdk-petstore.sh +++ b/bin/cpp-restsdk-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk $@" +ags="generate -t modules/openapi-generator/src/main/resources/cpp-rest-sdk-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g cpp-restsdk -o samples/client/petstore/cpp-restsdk/client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/csharp-petstore.sh b/bin/csharp-petstore.sh index 4185295fa1a..cbfeb6fab0d 100755 --- a/bin/csharp-petstore.sh +++ b/bin/csharp-petstore.sh @@ -32,6 +32,6 @@ ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with- java $JAVA_OPTS -jar $executable $ags # restore csproj file -echo "restore csproject file: CI/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj" +echo "restore csproject file: CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj" cp ./CI/samples.ci/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj ./samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/ diff --git a/bin/dart-flutter-petstore.sh b/bin/dart-flutter-petstore.sh index af7a58af75f..af3aaca2bec 100755 --- a/bin/dart-flutter-petstore.sh +++ b/bin/dart-flutter-petstore.sh @@ -28,18 +28,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ## Generate non-browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger -DhideGenerationTimestamp=true -DbrowserClient=false $@" +#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # ## then options to generate the library for vm would be: -##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm -DbrowserClient=false -DpubName=swagger_vm $@" +##ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger_vm --additional-properties browserClient=false,pubName=swagger_vm $@" #java $JAVA_OPTS -jar $executable $ags # ## Generate browserClient -#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +#ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/swagger-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" #java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/swagger --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart-jaguar-petstore.sh b/bin/dart-jaguar-petstore.sh index ffec056c46e..c5348cd34be 100755 --- a/bin/dart-jaguar-petstore.sh +++ b/bin/dart-jaguar-petstore.sh @@ -28,19 +28,19 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate client -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi --additional-properties hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_petstore/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate proto and put it to the flutter sample app -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi -Dserialization=proto -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi --additional-properties serialization=proto,hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # Generate proto and put it to the sample -ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi_proto -Dserialization=proto -DhideGenerationTimestamp=true -DpubName=openapi" +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml -g dart-jaguar -o samples/client/petstore/dart-jaguar/openapi_proto --additional-properties serialization=proto,hideGenerationTimestamp=true,pubName=openapi" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 669105c6ae5..ee60cb6c4f8 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false,supportDart2=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm --additional-properties supportDart2=false $@" +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm --additional-properties supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true,supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false,supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart2-petstore.sh b/bin/dart2-petstore.sh index 8fa61715ada..e8a57ffca7e 100755 --- a/bin/dart2-petstore.sh +++ b/bin/dart2-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@" java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/erlang-petstore-client.sh b/bin/erlang-petstore-client.sh index 7afeffd2e3f..77ee5acf0ef 100755 --- a/bin/erlang-petstore-client.sh +++ b/bin/erlang-petstore-client.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-client -DpackageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-client --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/erlang-petstore-proper.sh b/bin/erlang-petstore-proper.sh index 409b5f2eae4..4c19eec46df 100755 --- a/bin/erlang-petstore-proper.sh +++ b/bin/erlang-petstore-proper.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-proper -DpackageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-proper -o samples/client/petstore/erlang-proper $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-proper --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g erlang-proper -o samples/client/petstore/erlang-proper $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-gin-petstore-server.sh b/bin/go-gin-petstore-server.sh index 1ac7605d791..b18bffcdff7 100755 --- a/bin/go-gin-petstore-server.sh +++ b/bin/go-gin-petstore-server.sh @@ -35,7 +35,7 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags #!/usr/bin/env bash \ No newline at end of file diff --git a/bin/go-petstore-server.sh b/bin/go-petstore-server.sh index 32dfa8e93c4..3e5c19e436b 100755 --- a/bin/go-petstore-server.sh +++ b/bin/go-petstore-server.sh @@ -35,6 +35,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-petstore-withxml.sh b/bin/go-petstore-withxml.sh index 50b8cb27833..4c575497254 100755 --- a/bin/go-petstore-withxml.sh +++ b/bin/go-petstore-withxml.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore,withXml=true,withGoCodegenComment=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore,withXml=true,withGoCodegenComment=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/go-petstore.sh b/bin/go-petstore.sh index 865212c93ba..7dc5fe4907b 100755 --- a/bin/go-petstore.sh +++ b/bin/go-petstore.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/graphql-nodejs-express-server.sh b/bin/graphql-nodejs-express-server.sh index b257e529935..69ee4a3bf55 100755 --- a/bin/graphql-nodejs-express-server.sh +++ b/bin/graphql-nodejs-express-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/graphql-schema-petstore.sh b/bin/graphql-schema-petstore.sh index 10dfb5a5dc9..c6f36de2b5e 100755 --- a/bin/graphql-schema-petstore.sh +++ b/bin/graphql-schema-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g graphql-schema -o samples/config/petstore/graphql-schema --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/groovy-petstore.sh b/bin/groovy-petstore.sh index 99fa2e940a5..1a9db858a3c 100755 --- a/bin/groovy-petstore.sh +++ b/bin/groovy-petstore.sh @@ -27,5 +27,5 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Groovy/ -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Groovy/ -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g groovy -o samples/client/petstore/groovy --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-inflector-petstore-server.sh b/bin/java-inflector-petstore-server.sh index 1456a7457fd..b37e444a923 100755 --- a/bin/java-inflector-petstore-server.sh +++ b/bin/java-inflector-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaInflector -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-inflector -o samples/server/petstore/java-inflector -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaInflector -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-inflector -o samples/server/petstore/java-inflector --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-msf4j-petstore-server.sh b/bin/java-msf4j-petstore-server.sh index 8df820296c2..46ae1caef9a 100755 --- a/bin/java-msf4j-petstore-server.sh +++ b/bin/java-msf4j-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/java-msf4j-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ -DhideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@" +ags="generate -t modules/openapi-generator/src/main/resources/java-msf4j-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-msf4j -o samples/server/petstore/java-msf4j/ --additional-properties hideGenerationTimestamp=true --additional-properties artifactId=java-msf4j-server $@" echo "Removing files and folders under samples/server/petstore/java-msf4j/src/main" rm -rf samples/server/petstore/java-msf4j/src/main diff --git a/bin/java-petstore-feign-10x.sh b/bin/java-petstore-feign-10x.sh index 3ee6bd937e1..15b1b40e214 100755 --- a/bin/java-petstore-feign-10x.sh +++ b/bin/java-petstore-feign-10x.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-10x.json -o samples/client/petstore/java/feign10x -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-10x.json -o samples/client/petstore/java/feign10x --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/feign10x/src/main" rm -rf samples/client/petstore/java/feign10x/src/main diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index f6ead964ace..abac67deb9d 100755 --- a/bin/java-petstore-feign.sh +++ b/bin/java-petstore-feign.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-9x.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-9x.json -o samples/client/petstore/java/feign --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/feign/src/main" rm -rf samples/client/petstore/java/feign/src/main diff --git a/bin/java-petstore-google-api-client.sh b/bin/java-petstore-google-api-client.sh index ace4eb43870..20e3577f197 100755 --- a/bin/java-petstore-google-api-client.sh +++ b/bin/java-petstore-google-api-client.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/google-api-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-google-api-client.json -o samples/client/petstore/java/google-api-client -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/google-api-client -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-google-api-client.json -o samples/client/petstore/java/google-api-client --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/google-api-client/src/main" rm -rf samples/client/petstore/java/google-api-client/src/main diff --git a/bin/java-petstore-jersey1.sh b/bin/java-petstore-jersey1.sh index 2a6e6ab8f71..cb6e0ea3a6b 100755 --- a/bin/java-petstore-jersey1.sh +++ b/bin/java-petstore-jersey1.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 -DhideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true $@" +ags="generate --artifact-id petstore-java-client-jersey1 -t modules/openapi-generator/src/main/resources/Java -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -o samples/client/petstore/java/jersey1 --additional-properties hideGenerationTimestamp=true --library=jersey1 --additional-properties useNullForUnknownEnumValue=true $@" echo "Removing files and folders under samples/client/petstore/java/jersey1/src/main" rm -rf samples/client/petstore/java/jersey1/src/main diff --git a/bin/java-petstore-jersey2-java6.sh b/bin/java-petstore-jersey2-java6.sh index b0d32f84db6..4a5b032d0db 100755 --- a/bin/java-petstore-jersey2-java6.sh +++ b/bin/java-petstore-jersey2-java6.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 -DhideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" +ags="generate --artifact-id petstore-jersey2-java6 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java6 --additional-properties hideGenerationTimestamp=true,supportJava6=true,booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-java6/src/main" rm -rf samples/client/petstore/java/jersey2-java6/src/main diff --git a/bin/java-petstore-jersey2.sh b/bin/java-petstore-jersey2.sh index 05fc95fbc9e..e91dba6ff00 100755 --- a/bin/java-petstore-jersey2.sh +++ b/bin/java-petstore-jersey2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/jersey2/src/main" rm -rf samples/client/petstore/java/jersey2/src/main diff --git a/bin/java-petstore-okhttp-gson-parcelable.sh b/bin/java-petstore-okhttp-gson-parcelable.sh index 183aa87693a..ae4fbfd8d2b 100755 --- a/bin/java-petstore-okhttp-gson-parcelable.sh +++ b/bin/java-petstore-okhttp-gson-parcelable.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson-parcelableModel -DhideGenerationTimestamp=true,parcelableModel=true $@" +ags="generate --artifact-id petstore-okhttp-gson-parcelableModel -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson-parcelableModel --additional-properties hideGenerationTimestamp=true,parcelableModel=true $@" rm -rf samples/client/petstore/java/okhttp-gson-parcelableModel/src/main find samples/client/petstore/java/okhttp-gson-parcelableModel -maxdepth 1 -type f ! -name "README.md" -exec rm {} + diff --git a/bin/java-petstore-okhttp-gson.sh b/bin/java-petstore-okhttp-gson.sh index 3d788766122..8e7e7ac84e4 100755 --- a/bin/java-petstore-okhttp-gson.sh +++ b/bin/java-petstore-okhttp-gson.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-okhttp-gson.json -o samples/client/petstore/java/okhttp-gson --additional-properties hideGenerationTimestamp=true $@" rm -rf samples/client/petstore/java/okhttp-gson/src/main find samples/client/petstore/java/okhttp-gson -maxdepth 1 -type f ! -name "README.md" -exec rm {} + diff --git a/bin/java-petstore-rest-assured.sh b/bin/java-petstore-rest-assured.sh index 012f2dced08..cacc3cf3c27 100755 --- a/bin/java-petstore-rest-assured.sh +++ b/bin/java-petstore-rest-assured.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/rest-assured -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-rest-assured.json -o samples/client/petstore/java/rest-assured -DhideGenerationTimestamp=true --additional-properties booleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/rest-assured -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-rest-assured.json -o samples/client/petstore/java/rest-assured --additional-properties hideGenerationTimestamp=true --additional-properties booleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/rest-assured/src/main" rm -rf samples/client/petstore/java/rest-assured/src/main diff --git a/bin/java-petstore-resteasy.sh b/bin/java-petstore-resteasy.sh index c0a0b0c188c..ae611374131 100755 --- a/bin/java-petstore-resteasy.sh +++ b/bin/java-petstore-resteasy.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resteasy.json -o samples/client/petstore/java/resteasy -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resteasy.json -o samples/client/petstore/java/resteasy --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/resteasy/src/main" rm -rf samples/client/petstore/java/resteasy/src/main diff --git a/bin/java-petstore-resttemplate-withxml.sh b/bin/java-petstore-resttemplate-withxml.sh index fe44afde84d..19c142a2d4f 100755 --- a/bin/java-petstore-resttemplate-withxml.sh +++ b/bin/java-petstore-resttemplate-withxml.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml --artifact-id petstore-resttemplate-withxml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml -DhideGenerationTimestamp=true,withXml=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml --artifact-id petstore-resttemplate-withxml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate-withXml --additional-properties hideGenerationTimestamp=true,withXml=true $@" echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main" rm -rf samples/client/petstore/java/resttemplate-withXml/src/main diff --git a/bin/java-petstore-resttemplate.sh b/bin/java-petstore-resttemplate.sh index e1cf8ac27bc..d37d40059ff 100755 --- a/bin/java-petstore-resttemplate.sh +++ b/bin/java-petstore-resttemplate.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-resttemplate.json -o samples/client/petstore/java/resttemplate --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/resttemplate/src/main" rm -rf samples/client/petstore/java/resttemplate/src/main diff --git a/bin/java-petstore-retrofit.sh b/bin/java-petstore-retrofit.sh index e368e1b1b3a..127f16b44eb 100755 --- a/bin/java-petstore-retrofit.sh +++ b/bin/java-petstore-retrofit.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit -DhideGenerationTimestamp=true,dateLibrary=joda $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit.json -o samples/client/petstore/java/retrofit --additional-properties hideGenerationTimestamp=true,dateLibrary=joda $@" echo "Removing files and folders under samples/client/petstore/java/retrofit/src/main" rm -rf samples/client/petstore/java/retrofit/src/main diff --git a/bin/java-petstore-retrofit2-play24.sh b/bin/java-petstore-retrofit2-play24.sh index fa37a6f0d4b..4b94855865e 100755 --- a/bin/java-petstore-retrofit2-play24.sh +++ b/bin/java-petstore-retrofit2-play24.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play24 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play24.json -o samples/client/petstore/java/retrofit2-play24 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play24 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play24.json -o samples/client/petstore/java/retrofit2-play24 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play24/src/main" rm -rf samples/client/petstore/java/retrofit2-play24/src/main diff --git a/bin/java-petstore-retrofit2-play25.sh b/bin/java-petstore-retrofit2-play25.sh index f06506493f6..1954c2e045e 100755 --- a/bin/java-petstore-retrofit2-play25.sh +++ b/bin/java-petstore-retrofit2-play25.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play25 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play25.json -o samples/client/petstore/java/retrofit2-play25 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play25 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play25.json -o samples/client/petstore/java/retrofit2-play25 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play25/src/main" rm -rf samples/client/petstore/java/retrofit2-play25/src/main diff --git a/bin/java-petstore-retrofit2-play26.sh b/bin/java-petstore-retrofit2-play26.sh index edec7c1d214..0c582d09af1 100755 --- a/bin/java-petstore-retrofit2-play26.sh +++ b/bin/java-petstore-retrofit2-play26.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-java-client-retrofit2-play26 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play26.json -o samples/client/petstore/java/retrofit2-play26 -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id petstore-java-client-retrofit2-play26 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play26.json -o samples/client/petstore/java/retrofit2-play26 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2-play26/src/main" rm -rf samples/client/petstore/java/retrofit2-play26/src/main diff --git a/bin/java-petstore-retrofit2.sh b/bin/java-petstore-retrofit2.sh index 18251325cfe..2dce65f2724 100755 --- a/bin/java-petstore-retrofit2.sh +++ b/bin/java-petstore-retrofit2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2.json -o samples/client/petstore/java/retrofit2 --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2/src/main" rm -rf samples/client/petstore/java/retrofit2/src/main diff --git a/bin/java-petstore-retrofit2rx.sh b/bin/java-petstore-retrofit2rx.sh index fd29f093902..74729919db1 100755 --- a/bin/java-petstore-retrofit2rx.sh +++ b/bin/java-petstore-retrofit2rx.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx -DuseRxJava=true,hideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx.json -o samples/client/petstore/java/retrofit2rx --additional-properties useRxJava=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2rx/src/main" rm -rf samples/client/petstore/java/retrofit2rx/src/main diff --git a/bin/java-petstore-retrofit2rx2.sh b/bin/java-petstore-retrofit2rx2.sh index 33c35a9a6d3..05d6acb7bd0 100755 --- a/bin/java-petstore-retrofit2rx2.sh +++ b/bin/java-petstore-retrofit2rx2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx2.json -o samples/client/petstore/java/retrofit2rx2 -DuseRxJava2=true,hideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/retrofit2 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2rx2.json -o samples/client/petstore/java/retrofit2rx2 --additional-properties useRxJava2=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/retrofit2rx2/src/main" rm -rf samples/client/petstore/java/retrofit2rx2/src/main diff --git a/bin/java-petstore-vertx.sh b/bin/java-petstore-vertx.sh index badb9eff0f6..8eeb623b278 100755 --- a/bin/java-petstore-vertx.sh +++ b/bin/java-petstore-vertx.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/vertx -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-vertx.json -o samples/client/petstore/java/vertx -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/vertx -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-vertx.json -o samples/client/petstore/java/vertx --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/vertx/src/main" rm -rf samples/client/petstore/java/vertx/src/main diff --git a/bin/java-petstore-webclient.sh b/bin/java-petstore-webclient.sh index 7c737060192..c9402c60c0a 100755 --- a/bin/java-petstore-webclient.sh +++ b/bin/java-petstore-webclient.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-webclient.json -o samples/client/petstore/java/webclient -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-webclient.json -o samples/client/petstore/java/webclient --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/client/petstore/java/webclient/src/main" rm -rf samples/client/petstore/java/webclient/src/main diff --git a/bin/java-pkmst-petstore-server.sh b/bin/java-pkmst-petstore-server.sh index 9d98201b688..25d1c953197 100755 --- a/bin/java-pkmst-petstore-server.sh +++ b/bin/java-pkmst-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/java-pkmst -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-pkmst -o samples/server/petstore/java-pkmst/ -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/java-pkmst -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-pkmst -o samples/server/petstore/java-pkmst/ --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/java-pkmst/src/main" rm -rf samples/server/petstore/java-pkmst/src/main diff --git a/bin/java-play-framework-petstore-server-api-package-override.sh b/bin/java-play-framework-petstore-server-api-package-override.sh index d5069d98257..cba7507689e 100755 --- a/bin/java-play-framework-petstore-server-api-package-override.sh +++ b/bin/java-play-framework-petstore-server-api-package-override.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-api-package-override -DhideGenerationTimestamp=true,apiPackage=com.puppies.store.apis $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-api-package-override --additional-properties hideGenerationTimestamp=true,apiPackage=com.puppies.store.apis $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-async.sh b/bin/java-play-framework-petstore-server-async.sh index 86d5baf77f4..c09f9772fa3 100755 --- a/bin/java-play-framework-petstore-server-async.sh +++ b/bin/java-play-framework-petstore-server-async.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -c bin/java-play-framework-petstore-server-async.json -o samples/server/petstore/java-play-framework-async -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -c bin/java-play-framework-petstore-server-async.json -o samples/server/petstore/java-play-framework-async --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-controller-only.sh b/bin/java-play-framework-petstore-server-controller-only.sh index 94bf0b72777..85a23261221 100755 --- a/bin/java-play-framework-petstore-server-controller-only.sh +++ b/bin/java-play-framework-petstore-server-controller-only.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-controller-only -DhideGenerationTimestamp=true,controllerOnly=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-controller-only --additional-properties hideGenerationTimestamp=true,controllerOnly=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-fake-endpoints.sh b/bin/java-play-framework-petstore-server-fake-endpoints.sh index d9c45fca07a..0ae05412047 100755 --- a/bin/java-play-framework-petstore-server-fake-endpoints.sh +++ b/bin/java-play-framework-petstore-server-fake-endpoints.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-fake-endpoints -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-fake-endpoints --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-bean-validation.sh b/bin/java-play-framework-petstore-server-no-bean-validation.sh index b824bc82fbd..92b924b73d0 100755 --- a/bin/java-play-framework-petstore-server-no-bean-validation.sh +++ b/bin/java-play-framework-petstore-server-no-bean-validation.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-bean-validation -DhideGenerationTimestamp=true,useBeanValidation=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-bean-validation --additional-properties hideGenerationTimestamp=true,useBeanValidation=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-exception-handling.sh b/bin/java-play-framework-petstore-server-no-exception-handling.sh index c798713aacc..b9fe281c4c1 100755 --- a/bin/java-play-framework-petstore-server-no-exception-handling.sh +++ b/bin/java-play-framework-petstore-server-no-exception-handling.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-exception-handling -DhideGenerationTimestamp=true,handleExceptions=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-exception-handling --additional-properties hideGenerationTimestamp=true,handleExceptions=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-interface.sh b/bin/java-play-framework-petstore-server-no-interface.sh index 42fb56f7a1c..dbc4b8734ab 100755 --- a/bin/java-play-framework-petstore-server-no-interface.sh +++ b/bin/java-play-framework-petstore-server-no-interface.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-interface -DhideGenerationTimestamp=true,useInterfaces=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-interface --additional-properties hideGenerationTimestamp=true,useInterfaces=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-swagger-ui.sh b/bin/java-play-framework-petstore-server-no-swagger-ui.sh index 09e3936bbbb..494a0253161 100755 --- a/bin/java-play-framework-petstore-server-no-swagger-ui.sh +++ b/bin/java-play-framework-petstore-server-no-swagger-ui.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-swagger-ui -DhideGenerationTimestamp=true,useSwaggerUI=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-swagger-ui --additional-properties hideGenerationTimestamp=true,useSwaggerUI=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server-no-wrap-calls.sh b/bin/java-play-framework-petstore-server-no-wrap-calls.sh index 215dcf48ea1..7de56cc566e 100755 --- a/bin/java-play-framework-petstore-server-no-wrap-calls.sh +++ b/bin/java-play-framework-petstore-server-no-wrap-calls.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-wrap-calls -DhideGenerationTimestamp=true,wrapCalls=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework-no-wrap-calls --additional-properties hideGenerationTimestamp=true,wrapCalls=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-play-framework-petstore-server.sh b/bin/java-play-framework-petstore-server.sh index cb26c3c0836..b187c2e47b9 100755 --- a/bin/java-play-framework-petstore-server.sh +++ b/bin/java-play-framework-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaPlayFramework -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-play-framework -o samples/server/petstore/java-play-framework --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-vertx-async-petstore-server.sh b/bin/java-vertx-async-petstore-server.sh index bdedff11270..519dd79c2b3 100755 --- a/bin/java-vertx-async-petstore-server.sh +++ b/bin/java-vertx-async-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx -o samples/server/petstore/java-vertx/async -DvertxSwaggerRouterVersion=1.4.0 -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx -o samples/server/petstore/java-vertx/async --additional-properties vertxSwaggerRouterVersion=1.4.0,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java-vertx-rx-petstore-server.sh b/bin/java-vertx-rx-petstore-server.sh index 051798c8d45..651f03f777d 100755 --- a/bin/java-vertx-rx-petstore-server.sh +++ b/bin/java-vertx-rx-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx -DvertxSwaggerRouterVersion=1.4.0,rxInterface=true -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g java-vertx --artifact-id java-vertx-rx-server -o samples/server/petstore/java-vertx/rx --additional-properties vertxSwaggerRouterVersion=1.4.0,rxInterface=true --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/java8-petstore-jersey2.sh b/bin/java8-petstore-jersey2.sh index 739f75334e6..488fe202f29 100755 --- a/bin/java8-petstore-jersey2.sh +++ b/bin/java8-petstore-jersey2.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id petstore-jersey2-java8 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java8-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java8 -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id petstore-jersey2-java8 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java8-petstore-jersey2.json -o samples/client/petstore/java/jersey2-java8 --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" echo "Removing files and folders under samples/client/petstore/java/jersey2-java8/src/main" rm -rf samples/client/petstore/java/jersey2-java8/src/main diff --git a/bin/javascript-es6-petstore.sh b/bin/javascript-es6-petstore.sh index 8def380b258..7c80155bb15 100755 --- a/bin/javascript-es6-petstore.sh +++ b/bin/javascript-es6-petstore.sh @@ -29,6 +29,7 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ +--additional-properties appName=PetstoreClient \ -o samples/client/petstore/javascript-es6 $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-flowtyped-petstore.sh b/bin/javascript-flowtyped-petstore.sh index 92d88319821..061837a6384 100755 --- a/bin/javascript-flowtyped-petstore.sh +++ b/bin/javascript-flowtyped-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Javascript-Flowtyped -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g javascript-flowtyped -o samples/client/petstore/javascript-flowtyped -DappName=PetstoreClient $@" +ags="generate -t modules/openapi-generator/src/main/resources/Javascript-Flowtyped -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g javascript-flowtyped -o samples/client/petstore/javascript-flowtyped --additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-petstore.sh b/bin/javascript-petstore.sh index 3b73aa4be6b..f2313a0c198 100755 --- a/bin/javascript-petstore.sh +++ b/bin/javascript-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/Javascript -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples/client/petstore/javascript -DappName=PetstoreClient --additional-properties useES6=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/Javascript -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript -o samples/client/petstore/javascript --additional-properties appName=PetstoreClient,useES6=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-es6-petstore.sh b/bin/javascript-promise-es6-petstore.sh index 3dd0d7a4fca..c953eb99dad 100755 --- a/bin/javascript-promise-es6-petstore.sh +++ b/bin/javascript-promise-es6-petstore.sh @@ -30,6 +30,6 @@ export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ -o samples/client/petstore/javascript-promise-es6 \ ---additional-properties usePromises=true,useES6=true $@" +--additional-properties appName=PetstoreClient,usePromises=true,useES6=true $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/javascript-promise-petstore.sh b/bin/javascript-promise-petstore.sh index f6eb25b5c43..6702e60b2a3 100755 --- a/bin/javascript-promise-petstore.sh +++ b/bin/javascript-promise-petstore.sh @@ -33,6 +33,6 @@ ags="generate \ -g javascript \ -o samples/client/petstore/javascript-promise \ --additional-properties usePromises=true,useES6=false \ --DappName=PetstoreClient $@" +--additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-cdi-petstore-server.sh b/bin/jaxrs-cxf-cdi-petstore-server.sh index ee5d3d29a26..3d1e538c394 100755 --- a/bin/jaxrs-cxf-cdi-petstore-server.sh +++ b/bin/jaxrs-cxf-cdi-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-cdi -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf-cdi -o samples/server/petstore/jaxrs-cxf-cdi --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh b/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh index 8eac07795eb..3c8b96a2e64 100755 --- a/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh +++ b/bin/jaxrs-cxf-petstore-server-annotated-base-path.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-annotated-basepath -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-annotated-base-path -DhideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id cxf-annotated-basepath -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-annotated-base-path --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-non-spring-application.sh b/bin/jaxrs-cxf-petstore-server-non-spring-application.sh index 6ed2e5a05fe..6db712b74bb 100755 --- a/bin/jaxrs-cxf-petstore-server-non-spring-application.sh +++ b/bin/jaxrs-cxf-petstore-server-non-spring-application.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-server-non-spring -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-non-spring-app -DhideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 $@" +ags="generate --artifact-id cxf-server-non-spring -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf-non-spring-app --additional-properties hideGenerationTimestamp=true,generateNonSpringApplication=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server-test-data.sh b/bin/jaxrs-cxf-petstore-server-test-data.sh index 5b187c65fbf..6844b7bcf84 100755 --- a/bin/jaxrs-cxf-petstore-server-test-data.sh +++ b/bin/jaxrs-cxf-petstore-server-test-data.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id cxf-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data -DhideGenerationTimestamp=true -DuseAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true $@" +ags="generate --artifact-id cxf-test-data -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf-ext -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf-extended -o samples/server/petstore/jaxrs-cxf-test-data --additional-properties hideGenerationTimestamp=true,useAnnotatedBasePath=true --generate-alias-as-model --additional-properties java8=true,generateSpringApplication=true,generateSpringBootApplication=true,generateOperationBody=true,loadTestDataFromFile=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-cxf-petstore-server.sh b/bin/jaxrs-cxf-petstore-server.sh index 9efff273fa9..4081b01e862 100755 --- a/bin/jaxrs-cxf-petstore-server.sh +++ b/bin/jaxrs-cxf-petstore-server.sh @@ -30,6 +30,6 @@ rm -rf samples/server/petstore/jaxrs-cxf # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/cxf -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-cxf -o samples/server/petstore/jaxrs-cxf --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-jersey1-petstore-server.sh b/bin/jaxrs-jersey1-petstore-server.sh index 67576239847..3cc7cc87615 100755 --- a/bin/jaxrs-jersey1-petstore-server.sh +++ b/bin/jaxrs-jersey1-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1 -DhideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-server $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1 --additional-properties hideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-server $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey1/src/main" rm -rf samples/server/petstore/jaxrs/jersey1/src/main diff --git a/bin/jaxrs-jersey1-usetags-petstore-server.sh b/bin/jaxrs-jersey1-usetags-petstore-server.sh index 3e1c6bf6c06..00746c68db1 100755 --- a/bin/jaxrs-jersey1-usetags-petstore-server.sh +++ b/bin/jaxrs-jersey1-usetags-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1-useTags -DhideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-useTags --additional-properties useTags=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey1-useTags --additional-properties hideGenerationTimestamp=true,serverPort=8082 --library=jersey1 --artifact-id=jaxrs-jersey1-useTags --additional-properties useTags=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey1-useTags/src/main" rm -rf samples/server/petstore/jaxrs/jersey1-useTags/src/main diff --git a/bin/jaxrs-petstore-server-datelib-j8.sh b/bin/jaxrs-petstore-server-datelib-j8.sh index ef8e27e98df..64e9caff3bf 100755 --- a/bin/jaxrs-petstore-server-datelib-j8.sh +++ b/bin/jaxrs-petstore-server-datelib-j8.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-datelib-j8/ -c ./bin/jaxrs-datelib-j8.json -DhideGenerationTimestamp=true --additional-properties serverPort=8082 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-datelib-j8/ -c ./bin/jaxrs-datelib-j8.json --additional-properties hideGenerationTimestamp=true --additional-properties serverPort=8082 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-petstore-server.sh b/bin/jaxrs-petstore-server.sh index df248d61288..a75e5d3e55b 100755 --- a/bin/jaxrs-petstore-server.sh +++ b/bin/jaxrs-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-jersey-petstore-server -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2 -DhideGenerationTimestamp=true,serverPort=8082 $@" +ags="generate --artifact-id jaxrs-jersey-petstore-server -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2 --additional-properties hideGenerationTimestamp=true,serverPort=8082 $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey2/src/main" rm -rf samples/server/petstore/jaxrs/jersey2/src/main diff --git a/bin/jaxrs-resteasy-eap-java8-petstore-server.sh b/bin/jaxrs-resteasy-eap-java8-petstore-server.sh index 4a99e7c8851..8b85c903722 100755 --- a/bin/jaxrs-resteasy-eap-java8-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-java8-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-eap-java8-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-java8 -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-java8-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-eap-java8-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-java8 --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-java8-petstore-server.json $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-java8/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap-java8/src/main diff --git a/bin/jaxrs-resteasy-eap-joda-petstore-server.sh b/bin/jaxrs-resteasy-eap-joda-petstore-server.sh index 656774e441f..af9885025d6 100755 --- a/bin/jaxrs-resteasy-eap-joda-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-joda-petstore-server.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-eap-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-eap-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap-joda --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-eap-joda-petstore-server.json $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap-joda/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap-joda/src/main diff --git a/bin/jaxrs-resteasy-eap-petstore-server.sh b/bin/jaxrs-resteasy-eap-petstore-server.sh index 39c2bff75d9..7cc23202f48 100755 --- a/bin/jaxrs-resteasy-eap-petstore-server.sh +++ b/bin/jaxrs-resteasy-eap-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy-eap -o samples/server/petstore/jaxrs-resteasy/eap --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs-resteasy/eap/src/main" rm -rf samples/server/petstore/jaxrs-resteasy/eap/src/main diff --git a/bin/jaxrs-resteasy-joda-petstore-server.sh b/bin/jaxrs-resteasy-joda-petstore-server.sh index 086dd81c241..66bb1c3fffa 100755 --- a/bin/jaxrs-resteasy-joda-petstore-server.sh +++ b/bin/jaxrs-resteasy-joda-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id jaxrs-resteasy-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/joda -DhideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-joda-petstore-server.json $@" +ags="generate --artifact-id jaxrs-resteasy-joda-server -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/joda --additional-properties hideGenerationTimestamp=true -c ./bin/jaxrs-resteasy-joda-petstore-server.json $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-resteasy-petstore-server.sh b/bin/jaxrs-resteasy-petstore-server.sh index d6eabb20e75..6b40673aebd 100755 --- a/bin/jaxrs-resteasy-petstore-server.sh +++ b/bin/jaxrs-resteasy-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/default -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g jaxrs-resteasy -o samples/server/petstore/jaxrs-resteasy/default --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server-interface-returning-response.sh b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh index d964fa44e59..c4cc314bb4f 100755 --- a/bin/jaxrs-spec-petstore-server-interface-returning-response.sh +++ b/bin/jaxrs-spec-petstore-server-interface-returning-response.sh @@ -28,9 +28,9 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-interface-response-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec-interface-response --DhideGenerationTimestamp=true --DserializableModel=true --DinterfaceOnly=true --DreturnResponse=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true +--additional-properties interfaceOnly=true +--additional-properties returnResponse=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server-interface.sh b/bin/jaxrs-spec-petstore-server-interface.sh index 73c2479977c..570443e26ee 100755 --- a/bin/jaxrs-spec-petstore-server-interface.sh +++ b/bin/jaxrs-spec-petstore-server-interface.sh @@ -28,8 +28,8 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-interface-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec-interface --DhideGenerationTimestamp=true --DserializableModel=true --DinterfaceOnly=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true +--additional-properties interfaceOnly=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-spec-petstore-server.sh b/bin/jaxrs-spec-petstore-server.sh index 296b03b4fab..9d0c75513bd 100755 --- a/bin/jaxrs-spec-petstore-server.sh +++ b/bin/jaxrs-spec-petstore-server.sh @@ -28,7 +28,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate --artifact-id jaxrs-spec-petstore-server -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-spec -o samples/server/petstore/jaxrs-spec --DhideGenerationTimestamp=true --DserializableModel=true $@" +--additional-properties hideGenerationTimestamp=true +--additional-properties serializableModel=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/jaxrs-usetags-petstore-server.sh b/bin/jaxrs-usetags-petstore-server.sh index bd811f3a7e8..1c84b29a033 100755 --- a/bin/jaxrs-usetags-petstore-server.sh +++ b/bin/jaxrs-usetags-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2-useTags -DhideGenerationTimestamp=true,serverPort=8082 --artifact-id=jaxrs-jersey2-useTags --additional-properties useTags=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaJaxRS -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs/jersey2-useTags --additional-properties hideGenerationTimestamp=true,serverPort=8082 --artifact-id=jaxrs-jersey2-useTags --additional-properties useTags=true $@" echo "Removing files and folders under samples/server/petstore/jaxrs/jersey2-useTags/src/main" rm -rf samples/server/petstore/jaxrs/jersey2-useTags/src/main diff --git a/bin/kotlin-client-petstore.sh b/bin/kotlin-client-petstore.sh index fdcdb59b196..cad4be6995e 100755 --- a/bin/kotlin-client-petstore.sh +++ b/bin/kotlin-client-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client -D dateLibrary=java8 -o samples/client/petstore/kotlin $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/client/petstore/kotlin $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-client-string.sh b/bin/kotlin-client-string.sh index 2011e52e5e8..410ddbab399 100755 --- a/bin/kotlin-client-string.sh +++ b/bin/kotlin-client-string.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string -D dateLibrary=string -o samples/client/petstore/kotlin-string $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-string --additional-properties dateLibrary=string -o samples/client/petstore/kotlin-string $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-client-threetenbp.sh b/bin/kotlin-client-threetenbp.sh index c207268d8c3..0cb7f27da09 100755 --- a/bin/kotlin-client-threetenbp.sh +++ b/bin/kotlin-client-threetenbp.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-threetenbp -D dateLibrary=threetenbp -o samples/client/petstore/kotlin-threetenbp $@" +ags="generate -t modules/openapi-generator/src/main/resources/kotlin-client -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g kotlin --artifact-id kotlin-petstore-threetenbp --additional-properties dateLibrary=threetenbp -o samples/client/petstore/kotlin-threetenbp $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-server-petstore.sh b/bin/kotlin-server-petstore.sh index 43ab67d264c..dbdf48b2bbd 100755 --- a/bin/kotlin-server-petstore.sh +++ b/bin/kotlin-server-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-server -g kotlin-server --library=ktor -o samples/server/petstore/kotlin-server/ktor --additional-properties hideGenerationTimestamp=true $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/kotlin-springboot-petstore-all.sh b/bin/kotlin-springboot-petstore-all.sh new file mode 100755 index 00000000000..b0ba7a6e825 --- /dev/null +++ b/bin/kotlin-springboot-petstore-all.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./bin/kotlin-springboot-petstore-server.sh +./bin/kotlin-springboot-petstore-server-reactive.sh \ No newline at end of file diff --git a/bin/kotlin-springboot-petstore-server-reactive.sh b/bin/kotlin-springboot-petstore-server-reactive.sh new file mode 100755 index 00000000000..f5e72350b62 --- /dev/null +++ b/bin/kotlin-springboot-petstore-server-reactive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true" + +echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot-reactive" +rm -rf samples/server/petstore/kotlin-springboot-reactive + +echo "Generating Kotling Spring Boot reactive server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/lua-petstore.sh b/bin/lua-petstore.sh index b7adaaac460..44b5cc38637 100755 --- a/bin/lua-petstore.sh +++ b/bin/lua-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g lua -o samples/client/petstore/lua -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g lua -o samples/client/petstore/lua --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/nodejs-petstore-google-cloud-functions.sh b/bin/nodejs-petstore-google-cloud-functions.sh index 80e12027058..bfb02d960dc 100755 --- a/bin/nodejs-petstore-google-cloud-functions.sh +++ b/bin/nodejs-petstore-google-cloud-functions.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server-deprecated --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/nodejs-petstore-server.sh b/bin/nodejs-petstore-server.sh index 2dfc8f327c7..fbbed3e46f1 100755 --- a/bin/nodejs-petstore-server.sh +++ b/bin/nodejs-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g nodejs-server-deprecated -o samples/server/petstore/nodejs -Dservice $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/objc-petstore-coredata.sh b/bin/objc-petstore-coredata.sh index 124f800da21..ffa6d198822 100755 --- a/bin/objc-petstore-coredata.sh +++ b/bin/objc-petstore-coredata.sh @@ -26,7 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -c bin/objc-petstore.json $@" +export GENERATOR_GLOBALS="-DapiDocs=false -DmodelDocs=false" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties ${GENERATOR_GLOBALS}" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/2_0/petstore.json -g objc -o samples/client/petstore/objc/core-data --additional-properties coreData=true -c bin/objc-petstore.json $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/android-petstore-httpclient.sh b/bin/openapi3/android-petstore-httpclient.sh index e1616221492..a16ff89917a 100755 --- a/bin/openapi3/android-petstore-httpclient.sh +++ b/bin/openapi3/android-petstore-httpclient.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g android -Dlibrary=httpclient -o samples/client/petstore/android/httpclient $@" +ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/dart-petstore.sh b/bin/openapi3/dart-petstore.sh index f9da99019e0..2bab8d1abac 100755 --- a/bin/openapi3/dart-petstore.sh +++ b/bin/openapi3/dart-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +#ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm --additional-properties browserClient=false,pubName=openapi_vm $@" #java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client --additional-properties hideGenerationTimestamp=true,browserClient=true $@" #java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi --additional-properties hideGenerationTimestamp=true,browserClient=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/openapi3/erlang-petstore-client.sh b/bin/openapi3/erlang-petstore-client.sh index 102cc342d07..fc75014a41e 100755 --- a/bin/openapi3/erlang-petstore-client.sh +++ b/bin/openapi3/erlang-petstore-client.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/erlang-client -DpackageName=petstore -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" +ags="generate -t modules/openapi-generator/src/main/resources/erlang-client --additional-properties packageName=petstore -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g erlang-client -o samples/client/petstore/erlang-client $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/go-gin-petstore-server.sh b/bin/openapi3/go-gin-petstore-server.sh index a3f14d4b622..8ab2b8397e0 100755 --- a/bin/openapi3/go-gin-petstore-server.sh +++ b/bin/openapi3/go-gin-petstore-server.sh @@ -35,7 +35,7 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-gin-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags #!/usr/bin/env bash \ No newline at end of file diff --git a/bin/openapi3/go-petstore-server.sh b/bin/openapi3/go-petstore-server.sh index bbe46e70383..7909ec7d5db 100755 --- a/bin/openapi3/go-petstore-server.sh +++ b/bin/openapi3/go-petstore-server.sh @@ -35,6 +35,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/go-server -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstoreserver,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/go-petstore.sh b/bin/openapi3/go-petstore.sh index 872fcb610eb..ad921deae9c 100755 --- a/bin/openapi3/go-petstore.sh +++ b/bin/openapi3/go-petstore.sh @@ -34,6 +34,6 @@ rm -rf $STUB_DIR # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/go -i $SPEC -g $GENERATOR -o $STUB_DIR --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/graphql-nodejs-express-server.sh b/bin/openapi3/graphql-nodejs-express-server.sh index 0e1291c8a6d..41a69511601 100755 --- a/bin/openapi3/graphql-nodejs-express-server.sh +++ b/bin/openapi3/graphql-nodejs-express-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties $@" -ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/graphql-nodejs-express-server -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g graphql-nodejs-express-server -o samples/server/petstore/graphql-nodejs-express-server --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/groovy-petstore.sh b/bin/openapi3/groovy-petstore.sh index 1dd1d9c8021..c0c1ddda051 100755 --- a/bin/openapi3/groovy-petstore.sh +++ b/bin/openapi3/groovy-petstore.sh @@ -27,5 +27,5 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g groovy -o samples/client/petstore/groovy --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/javascript-es6-petstore.sh b/bin/openapi3/javascript-es6-petstore.sh index fac3a9039f6..96e45b4b8e7 100755 --- a/bin/openapi3/javascript-es6-petstore.sh +++ b/bin/openapi3/javascript-es6-petstore.sh @@ -29,6 +29,6 @@ fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" ags="generate -t modules/openapi-generator/src/main/resources/Javascript/es6 \ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g javascript \ --o samples/openapi3/client/petstore/javascript-es6 $@" +-o samples/openapi3/client/petstore/javascript-es6 --additional-properties appName=PetstoreClient $@" -java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/jaxrs-jersey-petstore.sh b/bin/openapi3/jaxrs-jersey-petstore.sh index ddb1968cdb3..2b1e71f73e1 100755 --- a/bin/openapi3/jaxrs-jersey-petstore.sh +++ b/bin/openapi3/jaxrs-jersey-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id "openapiv3-jaxrs-jersey-petstore-server" -t modules/openapi-generator/src/main/resources/JavaJaxRS/ -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g jaxrs-jersey -o samples/server/petstore/jaxrs-jersey --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/kotlin-client-petstore.sh b/bin/openapi3/kotlin-client-petstore.sh index cfd443d43e2..5ffd829b05d 100755 --- a/bin/openapi3/kotlin-client-petstore.sh +++ b/bin/openapi3/kotlin-client-petstore.sh @@ -26,7 +26,7 @@ then fi export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client -D dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -t modules/openapi-generator/src/main/resources/kotlin-client -g kotlin --artifact-id kotlin-petstore-client --additional-properties dateLibrary=java8 -o samples/openapi3/client/petstore/kotlin $@" echo "Cleaning previously generated files if any from samples/openapi3/client/petstore/kotlin" rm -rf samples/openapi3/client/petstore/kotlin diff --git a/bin/openapi3/kotlin-springboot-petstore-all.sh b/bin/openapi3/kotlin-springboot-petstore-all.sh new file mode 100755 index 00000000000..7aa4f697bbd --- /dev/null +++ b/bin/openapi3/kotlin-springboot-petstore-all.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +./bin/openapi3/kotlin-springboot-petstore-server.sh +./bin/openapi3/kotlin-springboot-petstore-server-reactive.sh diff --git a/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh b/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh new file mode 100755 index 00000000000..8c0d80c4e52 --- /dev/null +++ b/bin/openapi3/kotlin-springboot-petstore-server-reactive.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/openapi3/petstore/kotlin-springboot-reactive --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true,reactive=true" + +echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot-reactive" +rm -rf samples/server/openapi3/petstore/kotlin-springboot-reactive + +echo "Generating Kotling Spring Boot server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/lua-petstore.sh b/bin/openapi3/lua-petstore.sh index aa70c3b0696..f598c67aa02 100755 --- a/bin/openapi3/lua-petstore.sh +++ b/bin/openapi3/lua-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g lua -o samples/client/petstore/lua -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/lua -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g lua -o samples/client/petstore/lua --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/nodejs-petstore-google-cloud-functions.sh b/bin/openapi3/nodejs-petstore-google-cloud-functions.sh index a11e8da6c5d..00ab32fb9ab 100755 --- a/bin/openapi3/nodejs-petstore-google-cloud-functions.sh +++ b/bin/openapi3/nodejs-petstore-google-cloud-functions.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server-deprecated --additional-properties=googleCloudFunctions=true -o samples/server/petstore/nodejs-google-cloud-functions -Dservice $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/nodejs-petstore-server.sh b/bin/openapi3/nodejs-petstore-server.sh index df83e4ebfa6..a987aced357 100755 --- a/bin/openapi3/nodejs-petstore-server.sh +++ b/bin/openapi3/nodejs-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server -o samples/server/petstore/nodejs -Dservice $@" +ags="generate -t modules/openapi-generator/src/main/resources/nodejs -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g nodejs-server-deprecated -o samples/server/petstore/nodejs -Dservice $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/objc-petstore-coredata.sh b/bin/openapi3/objc-petstore-coredata.sh index 97fa054794f..ec36e2f510a 100755 --- a/bin/openapi3/objc-petstore-coredata.sh +++ b/bin/openapi3/objc-petstore-coredata.sh @@ -26,7 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -D apiDocs=false -D modelDocs=false -o samples/client/petstore/objc/core-data --additional-properties coreData=true -D appName=PetstoreClient $@" +export GENERATOR_GLOBALS="-DapiDocs=false -DmodelDocs=false" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties ${GENERATOR_GLOBALS}" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/core-data --additional-properties coreData=true,appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/objc-petstore.sh b/bin/openapi3/objc-petstore.sh index 11313e903d4..5840e39a450 100755 --- a/bin/openapi3/objc-petstore.sh +++ b/bin/openapi3/objc-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/default -D appName=PetstoreClient $@" +ags="generate -t modules/openapi-generator/src/main/resources/objc -i modules/openapi-generator/src/test/resources/3_0/petstore.json -g objc -o samples/client/petstore/objc/default --additional-properties appName=PetstoreClient $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/perl-petstore.sh b/bin/openapi3/perl-petstore.sh index 02293ae8b6f..7707591647b 100755 --- a/bin/openapi3/perl-petstore.sh +++ b/bin/openapi3/perl-petstore.sh @@ -28,6 +28,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -t modules/openapi-generator/src/main/resources/perl -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/perl -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/python-flask-petstore-python2.sh b/bin/openapi3/python-flask-petstore-python2.sh index c98569d10c4..2f303a57e3d 100755 --- a/bin/openapi3/python-flask-petstore-python2.sh +++ b/bin/openapi3/python-flask-petstore-python2.sh @@ -32,7 +32,7 @@ resources=modules/openapi-generator/src/main/resources/python-flask # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g python-flask -o $out_folder -c bin/supportPython2.json -D service $@" +ags="generate -t $resources -i $input -g python-flask -o $out_folder -c bin/supportPython2.json $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/openapi3/python-flask-petstore.sh b/bin/openapi3/python-flask-petstore.sh index 473c69a7b2c..fda1f6a5743 100755 --- a/bin/openapi3/python-flask-petstore.sh +++ b/bin/openapi3/python-flask-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/openapi3/petstore/python-flask resources=modules/openapi-generator/src/main/resources/python-flask # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g python-flask -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g python-flask -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/openapi3/python-petstore.sh b/bin/openapi3/python-petstore.sh index b1c5144bdfa..c1dce94f9c2 100755 --- a/bin/openapi3/python-petstore.sh +++ b/bin/openapi3/python-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/openapi3/client/petstore/python/ -DpackageName=petstore_api $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/openapi3/client/petstore/python/ --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/r-petstore.sh b/bin/openapi3/r-petstore.sh index cfc0d262acd..9ca5ed61d00 100755 --- a/bin/openapi3/r-petstore.sh +++ b/bin/openapi3/r-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g r -o samples/client/petstore/R -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g r -o samples/client/petstore/R --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/ruby-client-petstore.sh b/bin/openapi3/ruby-client-petstore.sh index 237b8ca6ae9..0be84e7eca8 100755 --- a/bin/openapi3/ruby-client-petstore.sh +++ b/bin/openapi3/ruby-client-petstore.sh @@ -38,6 +38,6 @@ find samples/openapi3/client/petstore/ruby/spec -type f -not -name petstore_help # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/openapi3/client/petstore/ruby -DskipFormModel=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/ruby-client -i modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml -g ruby -c bin/ruby-petstore.json -o samples/openapi3/client/petstore/ruby --additional-properties skipFormModel=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/rust-petstore.sh b/bin/openapi3/rust-petstore.sh index c252daaf1e6..a4812fc9093 100755 --- a/bin/openapi3/rust-petstore.sh +++ b/bin/openapi3/rust-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g rust -o samples/client/petstore/rust --additional-properties packageName=petstore_client $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/openapi3/typescript-angular-petstore-all.sh b/bin/openapi3/typescript-angular-petstore-all.sh index cf0116c6b25..bb0d6d2479c 100755 --- a/bin/openapi3/typescript-angular-petstore-all.sh +++ b/bin/openapi3/typescript-angular-petstore-all.sh @@ -37,7 +37,7 @@ ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (with interfaces generated)" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags echo "Typescript Petstore API client (v4 { Adding InjectionToken Over OpaqueToken })" diff --git a/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh b/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh index deff9fdba5c..3d74ccc1a95 100755 --- a/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh +++ b/bin/openapi3/typescript-angular-v2-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/typescript-fetch-petstore-interfaces.sh b/bin/openapi3/typescript-fetch-petstore-interfaces.sh index bf56d7ba9e4..d1e21dfbca7 100755 --- a/bin/openapi3/typescript-fetch-petstore-interfaces.sh +++ b/bin/openapi3/typescript-fetch-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/perl-deep-module-petstore.sh b/bin/perl-deep-module-petstore.sh index 25837a8fe9d..8e47a7d3b82 100755 --- a/bin/perl-deep-module-petstore.sh +++ b/bin/perl-deep-module-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl/deep_module_test -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl/deep_module_test --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags --additional-properties moduleName=Something::Deep -o samples/client/petstore/perl/deep_module_test diff --git a/bin/perl-petstore.sh b/bin/perl-petstore.sh index 36ac10a4ddd..48974454b73 100755 --- a/bin/perl-petstore.sh +++ b/bin/perl-petstore.sh @@ -28,6 +28,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl -DhideGenerationTimestamp=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g perl -o samples/client/petstore/perl --additional-properties hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-asyncio-petstore.sh b/bin/python-asyncio-petstore.sh index b551a8d4345..4219e51927e 100755 --- a/bin/python-asyncio-petstore.sh +++ b/bin/python-asyncio-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-asyncio -DpackageName=petstore_api --library asyncio $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-asyncio --additional-properties packageName=petstore_api --library asyncio $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-petstore.sh b/bin/python-petstore.sh index 96f67e76586..651fda1e721 100755 --- a/bin/python-petstore.sh +++ b/bin/python-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python -DpackageName=petstore_api $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python --additional-properties packageName=petstore_api $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-server-aiohttp-petstore.sh b/bin/python-server-aiohttp-petstore.sh index 38aae23d5f3..f5cc9bc711b 100755 --- a/bin/python-server-aiohttp-petstore.sh +++ b/bin/python-server-aiohttp-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-blueplanet-petstore.sh b/bin/python-server-blueplanet-petstore.sh index ece725e1c1b..074c53f8788 100755 --- a/bin/python-server-blueplanet-petstore.sh +++ b/bin/python-server-blueplanet-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-flask-petstore-python2.sh b/bin/python-server-flask-petstore-python2.sh index debbb458a15..f720fd5d4f4 100755 --- a/bin/python-server-flask-petstore-python2.sh +++ b/bin/python-server-flask-petstore-python2.sh @@ -30,9 +30,8 @@ input=modules/openapi-generator/src/test/resources/2_0/petstore.yaml out_folder=samples/server/petstore/$generator-python2 resources=modules/openapi-generator/src/main/resources/$generator -# if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -c bin/supportPython2.json -D service $@" +ags="generate -t $resources -i $input -g $generator -o $out_folder -c bin/supportPython2.json $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-server-flask-petstore.sh b/bin/python-server-flask-petstore.sh index 915aacd540a..eead0ce0d4f 100755 --- a/bin/python-server-flask-petstore.sh +++ b/bin/python-server-flask-petstore.sh @@ -31,8 +31,8 @@ out_folder=samples/server/petstore/$generator resources=modules/openapi-generator/src/main/resources/$generator # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t $resources -i $input -g $generator -o $out_folder -Dservice $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -Dservice" +ags="generate -t $resources -i $input -g $generator -o $out_folder $@" rm -rf $out_folder/.openapi* rm -rf $out_folder/openapi_server diff --git a/bin/python-tornado-petstore.sh b/bin/python-tornado-petstore.sh index 5ee9e2cc8bd..1d51e798fe9 100755 --- a/bin/python-tornado-petstore.sh +++ b/bin/python-tornado-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-tornado -DpackageName=petstore_api --library tornado $@" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g python -o samples/client/petstore/python-tornado --additional-properties packageName=petstore_api --library tornado $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/r-petstore.sh b/bin/r-petstore.sh index ac9d2427b6a..4decf28f72f 100755 --- a/bin/r-petstore.sh +++ b/bin/r-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g r -o samples/client/petstore/R -DpackageName=petstore $@" +ags="generate -t modules/openapi-generator/src/main/resources/r -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g r -o samples/client/petstore/R --additional-properties packageName=petstore $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/rust-petstore.sh b/bin/rust-petstore.sh index b58d3de7dd6..f8002951208 100755 --- a/bin/rust-petstore.sh +++ b/bin/rust-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust -DpackageName=petstore_client --library=hyper $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust --additional-properties packageName=petstore_client --library=hyper $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/rust-reqwest-petstore.sh b/bin/rust-reqwest-petstore.sh index 054a757c5fa..7a5fc8d8cdd 100755 --- a/bin/rust-reqwest-petstore.sh +++ b/bin/rust-reqwest-petstore.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest -DpackageName=petstore_client --library=reqwest $@" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g rust -o samples/client/petstore/rust-reqwest --additional-properties packageName=petstore_client --library=reqwest $@" java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/bin/rust-server-petstore.sh b/bin/rust-server-petstore.sh index 5aa1344766c..e0a459d59e7 100755 --- a/bin/rust-server-petstore.sh +++ b/bin/rust-server-petstore.sh @@ -32,7 +32,7 @@ for spec_path in modules/openapi-generator/src/test/resources/*/rust-server/* ; --input-spec $spec_path --generator-name rust-server --output samples/server/petstore/rust-server/output/$spec - -DpackageName=$spec + --additional-properties packageName=$spec --additional-properties hideGenerationTimestamp=true --generate-alias-as-model $@" diff --git a/bin/spring-cloud-feign-petstore.sh b/bin/spring-cloud-feign-petstore.sh index 2c0c758e806..2dfef88064f 100755 --- a/bin/spring-cloud-feign-petstore.sh +++ b/bin/spring-cloud-feign-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -c bin/spring-cloud-feign-petstore.json -o samples/client/petstore/spring-cloud -DhideGenerationTimestamp=true,responseWrapper=HystrixCommand $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -c bin/spring-cloud-feign-petstore.json -o samples/client/petstore/spring-cloud --additional-properties hideGenerationTimestamp=true,responseWrapper=HystrixCommand $@" echo "Removing files and folders under samples/client/petstore/spring-cloud/src/main" rm -rf samples/client/petstore/spring-cloud/src/main diff --git a/bin/spring-delegate-j8.sh b/bin/spring-delegate-j8.sh index 56146e282ba..df75a5d169b 100755 --- a/bin/spring-delegate-j8.sh +++ b/bin/spring-delegate-j8.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-delegate-j8 -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate-j8 -DdelegatePattern=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-delegate-j8 -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate-j8 --additional-properties delegatePattern=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-delegate-j8/src/main" rm -rf samples/server/petstore/springboot-delegate-j8/src/main diff --git a/bin/spring-delegate.sh b/bin/spring-delegate.sh index 4cf133072c2..2404c24cedc 100755 --- a/bin/spring-delegate.sh +++ b/bin/spring-delegate.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-delegate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate -DdelegatePattern=true,hideGenerationTimestamp=true,java8=false $@" +ags="generate --artifact-id springboot-delegate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-delegate --additional-properties delegatePattern=true,hideGenerationTimestamp=true,java8=false $@" echo "Removing files and folders under samples/server/petstore/springboot-delegate/src/main" rm -rf samples/server/petstore/springboot-delegate/src/main diff --git a/bin/spring-mvc-petstore-j8-async-server.sh b/bin/spring-mvc-petstore-j8-async-server.sh index e55cfe647a4..fdbb35d4b41 100755 --- a/bin/spring-mvc-petstore-j8-async-server.sh +++ b/bin/spring-mvc-petstore-j8-async-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json -DhideGenerationTimestamp=true,async=true --additional-properties serverPort=8002 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/spring-mvc-j8-async -c bin/spring-mvc-petstore-j8-async.json --additional-properties hideGenerationTimestamp=true,async=true --additional-properties serverPort=8002 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-j8-localdatetime.sh b/bin/spring-mvc-petstore-j8-localdatetime.sh index e5a32b7dc7a..ae3b16177af 100755 --- a/bin/spring-mvc-petstore-j8-localdatetime.sh +++ b/bin/spring-mvc-petstore-j8-localdatetime.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-j8-localdatetime.json -o samples/server/petstore/spring-mvc-j8-localdatetime -DhideGenerationTimestamp=true -DbooleanGetterPrefix=get --additional-properties serverPort=8002 $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-j8-localdatetime.json -o samples/server/petstore/spring-mvc-j8-localdatetime --additional-properties hideGenerationTimestamp=true,booleanGetterPrefix=get,serverPort=8002 $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-mvc-petstore-server.sh b/bin/spring-mvc-petstore-server.sh index 71e6d73fac3..ddbb1b4d64f 100755 --- a/bin/spring-mvc-petstore-server.sh +++ b/bin/spring-mvc-petstore-server.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-server.json -o samples/server/petstore/spring-mvc -DhideGenerationTimestamp=true,java8=false --additional-properties serverPort=8002 --additional-properties booleanGetterPrefix=get $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/spring-mvc-petstore-server.json -o samples/server/petstore/spring-mvc --additional-properties hideGenerationTimestamp=true,java8=false --additional-properties serverPort=8002 --additional-properties booleanGetterPrefix=get $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-stubs.sh b/bin/spring-stubs.sh index 1586459d3aa..79edfa1820e 100755 --- a/bin/spring-stubs.sh +++ b/bin/spring-stubs.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id spring-stubs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -o samples/client/petstore/spring-stubs -DinterfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id spring-stubs -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g spring -o samples/client/petstore/spring-stubs --additional-properties interfaceOnly=true,singleContentTypes=true,hideGenerationTimestamp=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/springboot-petstore-server-beanvalidation.sh b/bin/springboot-petstore-server-beanvalidation.sh index 18f232ef6bd..33b1fdce58b 100755 --- a/bin/springboot-petstore-server-beanvalidation.sh +++ b/bin/springboot-petstore-server-beanvalidation.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-beanvalidation -c bin/springboot-petstore-server-beanvalidation.json -DhideGenerationTimestamp=true,java8=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-beanvalidation -c bin/springboot-petstore-server-beanvalidation.json --additional-properties hideGenerationTimestamp=true,java8=false $@" echo "Removing files and folders under samples/server/petstore/springboot-beanvalidation/src/main" rm -rf samples/server/petstore/springboot-beanvalidation/src/main diff --git a/bin/springboot-petstore-server-implicitHeaders.sh b/bin/springboot-petstore-server-implicitHeaders.sh index 8c56ade82ce..277c57fcbdd 100755 --- a/bin/springboot-petstore-server-implicitHeaders.sh +++ b/bin/springboot-petstore-server-implicitHeaders.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-implicitHeaders -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-implicitHeaders.json -o samples/server/petstore/springboot-implicitHeaders -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-implicitHeaders -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-implicitHeaders.json -o samples/server/petstore/springboot-implicitHeaders --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-implicitHeaders/src/main" rm -rf samples/server/petstore/springboot-implicitHeaders/src/main diff --git a/bin/springboot-petstore-server-reactive.sh b/bin/springboot-petstore-server-reactive.sh index 9938be6aba5..6cc531e66e2 100755 --- a/bin/springboot-petstore-server-reactive.sh +++ b/bin/springboot-petstore-server-reactive.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive -Dreactive=true,delegatePattern=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive --additional-properties reactive=true,delegatePattern=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-reactive/src/main" rm -rf samples/server/petstore/springboot-reactive/src/main diff --git a/bin/springboot-petstore-server-useOptional.sh b/bin/springboot-petstore-server-useOptional.sh index 35336dce752..029f923862a 100755 --- a/bin/springboot-petstore-server-useOptional.sh +++ b/bin/springboot-petstore-server-useOptional.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-useOptional.json -o samples/server/petstore/springboot-useoptional -DhideGenerationTimestamp=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -c bin/springboot-petstore-server-useOptional.json -o samples/server/petstore/springboot-useoptional --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-useoptional/src/main" rm -rf samples/server/petstore/springboot-useoptional/src/main diff --git a/bin/springboot-petstore-server.sh b/bin/springboot-petstore-server.sh index 725ac389007..9b34934163d 100755 --- a/bin/springboot-petstore-server.sh +++ b/bin/springboot-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot/src/main" rm -rf samples/server/petstore/springboot/src/main diff --git a/bin/springboot-virtualan-petstore-server.sh b/bin/springboot-virtualan-petstore-server.sh index a55eea9fafb..a8471cf1998 100755 --- a/bin/springboot-virtualan-petstore-server.sh +++ b/bin/springboot-virtualan-petstore-server.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-virtualan -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-virtualan -c bin/springboot-virtualan-petstore-server.json -DhideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-virtualan -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-virtualan -c bin/springboot-virtualan-petstore-server.json --additional-properties hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-virtualan/src/main" rm -rf samples/server/petstore/springboot-virtualan/src/main diff --git a/bin/tests/test-debug-supporting-files.sh b/bin/tests/test-debug-supporting-files.sh index 3d6a2e86967..cd130225b4a 100755 --- a/bin/tests/test-debug-supporting-files.sh +++ b/bin/tests/test-debug-supporting-files.sh @@ -26,8 +26,8 @@ then fi # if you've executed sbt assembly previously it will use that instead. -export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/issue_241.yaml -g python -o /tmp/test-debug-supporting-files/ -DpackageName=petstore_api -DdebugSupportingFiles=true $@" +export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DdebugSupportingFiles=true" +ags="generate -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/issue_241.yaml -g python -o /tmp/test-debug-supporting-files/ --additional-properties packageName=petstore_api $@" if [[ $(java $JAVA_OPTS -jar $executable $ags 2>&1 | grep "StackOverflowError") ]]; then echo "There are StackOverflowError. Please check the result." diff --git a/bin/typescript-angular-v2-petstore-interfaces.sh b/bin/typescript-angular-v2-petstore-interfaces.sh index 6db2f6e11d6..18f638f4dfe 100755 --- a/bin/typescript-angular-v2-petstore-interfaces.sh +++ b/bin/typescript-angular-v2-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces -D withInterfaces=true --additional-properties ngVersion=2 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v2/with-interfaces --additional-properties ngVersion=2,withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh b/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh index 082f197a716..981e55dbc28 100755 --- a/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh +++ b/bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v6-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/with-npm --additional-properties ngVersion=6.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v6-petstore-not-provided-in-root.sh b/bin/typescript-angular-v6-petstore-not-provided-in-root.sh index deddf8d536f..f00826e050f 100755 --- a/bin/typescript-angular-v6-petstore-not-provided-in-root.sh +++ b/bin/typescript-angular-v6-petstore-not-provided-in-root.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=6.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v6-not-provided-in-root/builds/default --additional-properties ngVersion=6.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh b/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh index 4cb66477ee8..f74cb16b02a 100755 --- a/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh +++ b/bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm -D providedInRoot=false --additional-properties ngVersion=7.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -c bin/typescript-angular-v7-petstore-not-provided-in-root-with-npm.json -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/with-npm --additional-properties ngVersion=7.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-angular-v7-petstore-not-provided-in-root.sh b/bin/typescript-angular-v7-petstore-not-provided-in-root.sh index d790a67c67b..46eb22cbc4d 100755 --- a/bin/typescript-angular-v7-petstore-not-provided-in-root.sh +++ b/bin/typescript-angular-v7-petstore-not-provided-in-root.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default -D providedInRoot=false --additional-properties ngVersion=7.0.0 $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-angular -o samples/client/petstore/typescript-angular-v7-not-provided-in-root/builds/default --additional-properties ngVersion=7.0.0,providedInRoot=false $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-axios-petstore-interfaces.sh b/bin/typescript-axios-petstore-interfaces.sh index 6ba5985126a..84a65e0aba3 100755 --- a/bin/typescript-axios-petstore-interfaces.sh +++ b/bin/typescript-axios-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-fetch-petstore-interfaces.sh b/bin/typescript-fetch-petstore-interfaces.sh index 58a9137820d..412d778b4f9 100755 --- a/bin/typescript-fetch-petstore-interfaces.sh +++ b/bin/typescript-fetch-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-rxjs-petstore-interfaces.sh b/bin/typescript-rxjs-petstore-interfaces.sh index 92f6e8f328e..c7b52aca526 100755 --- a/bin/typescript-rxjs-petstore-interfaces.sh +++ b/bin/typescript-rxjs-petstore-interfaces.sh @@ -27,6 +27,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-rxjs -o samples/client/petstore/typescript-rxjs/builds/with-interfaces -D withInterfaces=true $@" +ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-rxjs -o samples/client/petstore/typescript-rxjs/builds/with-interfaces --additional-properties withInterfaces=true $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 3d5909a88d8..166c8c60bd1 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -25,6 +25,7 @@ declare -a scripts=( "./bin/kotlin-client-threetenbp.sh" "./bin/kotlin-server-petstore.sh" "./bin/kotlin-springboot-petstore-server.sh" +"./bin/kotlin-springboot-petstore-server-reactive.sh" "./bin/mysql-schema-petstore.sh" "./bin/python-petstore-all.sh" "./bin/openapi3/python-petstore.sh" @@ -51,9 +52,11 @@ declare -a scripts=( "./bin/csharp-netcore-petstore-all.sh" "./bin/elixir-petstore.sh" "./bin/go-petstore.sh" +"./bin/go-petstore-withxml.sh" "./bin/go-gin-petstore-server.sh" "./bin/groovy-petstore.sh" "./bin/apex-petstore.sh" +"./bin/perl-petstore-all.sh" #"./bin/elm-petstore-all.sh" "./bin/meta-codegen.sh" # OTHERS diff --git a/bin/utils/release/bump.sh b/bin/utils/release/bump.sh new file mode 100755 index 00000000000..1afeffde16b --- /dev/null +++ b/bin/utils/release/bump.sh @@ -0,0 +1,221 @@ +#!/usr/bin/env bash +# +# This script bumps from one version to another +# +# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare -r version_regex="([0-9]+).([0-9]+).([0-9]+)-?(SNAPSHOT){0,1}" +declare start="" +declare end="" +declare from="${version_regex}" +declare to="" +declare debug=${debug:-false} +declare -a from_parts=() +declare -a to_parts=() +declare -ar inc=(major minor build snapshot) + +USAGE=" +USAGE: $0 OPTIONS input_file + + This script will bump a version number (or other value) between marker tags. + +OPTIONS: + -f The 'from' version + -t The 'to' version + -s The start tag regex + default: $start + -e The end tag regex + default: $end + -i Increase by one of: ${inc[@]} + -h Print this message + +EXAMPLES: + +Update to next snapshot version: + $0 -f 3.0.0 -t 3.0.1-SNAPSHOT pom.xml +Update build version only (useful for docs) + $0 -f 3.0.0 -t 3.0.1 pom.xml +Update from any version to any other version + $0 -f 1.2.3 -t 9.9.9-SNAPSHOT pom.xml +Customize the start/end tags + $0 -f 1.0.0 1.0.1-SNAPSHOT -s \"\" -e \"\" pom.xml +" + + +## print an error message and exit +err() { + >&2 echo -e "$1" + exit 1 +} + +## debug log messages. Run with debug=true ./bump.sh +d() { + if [[ true = "${debug}" ]]; then + echo "$1" + fi +} + +## outputs usage and exits +usage() +{ + err "${USAGE}" + exit 1 +} + +## usage: version input extracted_array +## - Checks that 'input' is a valid version +## - Extracts the version parts into 'extracted_array' +version() +{ + if [[ "$#" -ne 2 ]]; then + err "Call function version with two parameters: version string arr" + fi + local v=$1 + if [[ "${v}" =~ $version_regex ]]; then + local major=${BASH_REMATCH[1]} + local minor=${BASH_REMATCH[2]} + local build=${BASH_REMATCH[3]} + local snapshot=false + if [[ "SNAPSHOT" = "${BASH_REMATCH[4]}" ]]; then + snapshot=true + fi + + d "major=$major minor=$minor build=$build snapshot=$snapshot" + + eval "$2=(${major} ${minor} ${build} ${snapshot})" + else + err "Invalid version: $v" + fi +} + +while getopts "hf:t:s:e:i:" OPTION +do + case ${OPTION} in + f) + from=${OPTARG} + ;; + t) + to=${OPTARG} + ;; + s) + start=${OPTARG} + ;; + e) + end=${OPTARG} + ;; + i) + increase=${OPTARG} + if [[ ! "${inc[@]}" =~ ${increase} ]];then + err "Only support increasing by one of: ${inc[@]}" + fi + ;; + h) + usage + ;; + esac +done + +shift $((OPTIND-1)) +file=( "$@" ) + +if [[ ${#file[@]} -eq 0 ]];then + echo "No file specified" >&2 + usage +fi + +if [[ -z "${from}" ]]; then + echo "No 'from' version specified." >&2 + usage +fi + +# TODO: compare steps in from_parts and to_parts. +version "${from}" from_parts + +if [[ -z "${to}" ]]; then + if [[ -z "${increase}" ]]; then + err "No 'to' version specified." + else + case ${increase} in + major) + to="$(( ${from_parts[0]} + 1 )).0.0" + version "$to" to_parts + ;; + minor) + to="${from_parts[0]}.$(( ${from_parts[1]} + 1 )).0" + version "$to" to_parts + ;; + build) + to="${from_parts[0]}.${from_parts[1]}.$(( ${from_parts[2]} + 1 ))" + version "$to" to_parts + ;; + snapshot) + if [[ true = ${from_parts[3]} ]]; then + err "Can't move from SNAPSHOT to SNAPSHOT (from=${from})." + else + to="${from_parts[0]}.${from_parts[1]}.$(( ${from_parts[2]} + 1 ))-SNAPSHOT" + version "$to" to_parts + fi + ;; + esac + fi +else + version "${to}" to_parts +fi + +if [[ ${from_parts[3]} = true && ${to_parts[3]} = true ]]; then + err "Moving from SNAPSHOT to SNAPSHOT is not supported." +fi + +cat < sedscript.sed +/${start}/,/${end}/{ + s/${from}/${to}/g +} +EOF + +d "Moving from=${from} to=${to}" + +trap 'rm -f sedscript.sed' EXIT + +sed_cross() { + # Cross-platform sed invocation. OSX has no option to show a version number in sed. + local target=$1 + sed --version >/dev/null 2>&1 && sed -e -i '' -f sedscript.sed "$target" || sed -i '' -E -f sedscript.sed "$target" +} + +update_file() { + local filename=$1 + local error_message="ERROR: Failed to update $filename to target version ${to}" + local original_hash=$(ruby -r digest -e "p Digest::SHA2.file(\"$filename\").hexdigest") + local final_hash="" + if ! sed_cross ${filename}; then + # occurs if, for example, the file doesn't exist. + echo "ERROR: Failed to update $filename to target version ${to}" >&2 + fi + + local final_hash=$(ruby -r digest -e "p Digest::SHA2.file(\"$filename\").hexdigest") + + if [[ "${original_hash}" = "${final_hash}" ]]; then + # occurs if, for example, the file doesn't have expected marker tags for replacement + echo "ERROR: $filename was not modified." >&2 + else + echo "Updated $filename successfully!" + fi +} + +for filename in "${file[@]}"; do + update_file ${filename} +done + diff --git a/bin/utils/release/release_version_update.sh b/bin/utils/release/release_version_update.sh new file mode 100755 index 00000000000..abc227a2027 --- /dev/null +++ b/bin/utils/release/release_version_update.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash +# +# This script is used to update files to the "latest" version. +# +# usage: ./bin/utils/release_version_update.sh +# example: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1 +# +# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare cwd=$(cd $(dirname "${BASH_SOURCE}") && pwd) +declare root=$(cd "$cwd" && cd ../../../ && pwd) + +USAGE=" +USAGE: $0 target + + This script will convert the current version in target files to the specified 'target' + where target is one of: + + major + minor + build + snapshot + +EXAMPLES: + +Update to new snapshot (1.0.0 -> 1.0.1-SNAPSHOT): + $0 snapshot +Update build version (1.0.0 -> 1.0.1) + $0 build +Update minor version (1.2.3 -> 1.3.0) + $0 minor +Update major version (1.2.3 -> 2.0.0) + $0 major +" + +version=$(ruby -r rexml/document -e 'include REXML; + p XPath.first(Document.new($stdin), "/project/version/text()")' < ${cwd}/../../../pom.xml | tr -d '"') + +if [[ -n "$1" ]]; then + case $1 in + --help|-h) + echo -e "$USAGE" >&2 + exit 1 + ;; + major|minor|build|snapshot) + inc="$1" + ;; + *) + echo "Invalid target.Must be one of: major minor build or snapshot" >&2 + exit 1 + ;; + esac +else + inc="snapshot" +fi + +echo "Release preparation: Moving from $version to next $inc version." + +# These files should wrap target version replacement blocks with and +# We can include xml and md files here. +declare -a xml_files=( + "${root}/modules/openapi-generator-cli/pom.xml" + "${root}/modules/openapi-generator-gradle-plugin/pom.xml" + "${root}/modules/openapi-generator-core/pom.xml" + "${root}/modules/openapi-generator-maven-plugin/pom.xml" + "${root}/modules/openapi-generator-online/pom.xml" + "${root}/modules/openapi-generator/pom.xml" + "${root}/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml" + "${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml" + "${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml" + "${root}/modules/openapi-generator-maven-plugin/examples/non-java.xml" + "${root}/samples/meta-codegen/lib/pom.xml" + "${root}/pom.xml" +) + +# These files should wrap target version replacement blocks with # RELEASE_VERSION and # /RELEASE_VERSION +declare -a properties_files=( + "${root}/modules/openapi-generator-gradle-plugin/gradle.properties" + "${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties" +) + +${cwd}/bump.sh -f ${version} -i ${inc} ${xml_files[@]} +${cwd}/bump.sh -f ${version} -t ${inc} -s '# RELEASE_VERSION' -e '# \/RELEASE_VERSION' ${properties_files[@]} diff --git a/bin/utils/release/release_version_update_docs.sh b/bin/utils/release/release_version_update_docs.sh new file mode 100755 index 00000000000..287b9a3e7df --- /dev/null +++ b/bin/utils/release/release_version_update_docs.sh @@ -0,0 +1,115 @@ +#!/usr/bin/env bash +# +# This script is used to update reference files to the "next" version. +# +# usage: ./bin/utils/release_version_update.sh +# example: ./bin/utils/release_version_update.sh 3.0.1 3.0.2 +# +# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +declare cwd=$(cd $(dirname "${BASH_SOURCE}") && pwd) +declare root=$(cd "$cwd" && cd ../../../ && pwd) + +USAGE=" +USAGE: $0 version target + + This script will convert the specified version in DOC target files to the 'target' + where target is one of: + + major + minor + build + + or an explicitly defined version number. + +NOTE: + + Files prepped by this script should never target SNAPSHOT, as the docs should refer to release artifacts. + If intending to update to/from snapshots, please add target files to release_version_update.sh instead. + +EXAMPLES: + +Update build version (1.0.0 -> 1.0.1) + $0 1.0.0 build +Update minor version (1.2.3 -> 1.3.0) + $0 1.2.3 minor +Update major version (1.2.3 -> 2.0.0) + $0 1.2.3 major +" + +declare version=$(ruby -r rexml/document -e 'include REXML; + p XPath.first(Document.new($stdin), "/project/version/text()")' < ${cwd}/../../../pom.xml | tr -d '"') + +declare target="${2:-build}" +declare inc="" +declare next_version="" +declare ags="" + +if [[ -z "$1" ]]; then + echo "Missing argument." >&2 + echo -e "$USAGE" >&2 + exit 1 +fi + +# Get version number we're changing +case $1 in + --help|-h) + echo -e "$USAGE" >&2 + exit 1 + ;; + *) + version="$1" + ;; +esac + +# Get the target… +case ${target} in + major|minor|build) + inc="$target" + ;; + snapshot) + echo -e "Files prepped by this script should never target SNAPSHOT, as the docs should refer to release artifacts. + If intending to update to/from snapshots, please add target files to release_version_update.sh instead. + " >&2 + exit 1 + ;; + *) + next_version="$target" + ;; +esac + +ags="-f ${version}" + +if [[ -n "${next_version}" ]];then + echo "Release preparation: Moving from $version to ${next_version}." + ags="$ags -t ${next_version}" +else + echo "Release preparation: Moving from $version to next $inc version." + ags="$ags -i ${inc}" +fi + +declare -a xml_files=( + "${root}/modules/openapi-generator-maven-plugin/README.md" + "${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md" + "${root}/README.md" +) + +declare -a commented_files=( + "${root}/modules/openapi-generator-gradle-plugin/README.adoc" +) + +${cwd}/bump.sh ${ags} ${xml_files[@]} +${cwd}/bump.sh ${ags} -s '# RELEASE_VERSION' -e '# \/RELEASE_VERSION' ${commented_files[@]} diff --git a/bin/utils/release/testing.txt b/bin/utils/release/testing.txt new file mode 100644 index 00000000000..300bdac6f68 --- /dev/null +++ b/bin/utils/release/testing.txt @@ -0,0 +1,17 @@ +This is a test simple: +3.0.1 + +Testing with other data: + +Version 1.2.3 + + +Testing with -SNAPSHOT data: + +Version 2.3.4-SNAPSHOT + + +Testing with a value not to be replaced: + +Version 3.2.2 + diff --git a/bin/utils/release/testing2.txt b/bin/utils/release/testing2.txt new file mode 100644 index 00000000000..300bdac6f68 --- /dev/null +++ b/bin/utils/release/testing2.txt @@ -0,0 +1,17 @@ +This is a test simple: +3.0.1 + +Testing with other data: + +Version 1.2.3 + + +Testing with -SNAPSHOT data: + +Version 2.3.4-SNAPSHOT + + +Testing with a value not to be replaced: + +Version 3.2.2 + diff --git a/bin/utils/release_checkout.rb b/bin/utils/release_checkout.rb index 720f139c41e..8f82bf4bdc4 100755 --- a/bin/utils/release_checkout.rb +++ b/bin/utils/release_checkout.rb @@ -40,7 +40,8 @@ end def check_openapi_generator_online_docker print "Checking openapi-generator-online docker ... " - url = "https://hub.docker.com/r/openapitools/openapi-generator-online/tags/" + url = "https://hub.docker.com/v2/repositories/openapitools/openapi-generator-online/tags/?page_size=25&page=1" + docker_tag = "v#{$version}" open(url) do |f| content = f.read @@ -56,7 +57,7 @@ end def check_openapi_generator_cli_docker print "Checking openapi-generator-cli docker ... " - url = "https://hub.docker.com/r/openapitools/openapi-generator-cli/tags/" + url = "https://hub.docker.com/v2/repositories/openapitools/openapi-generator-cli/tags/?page_size=25&page=1" docker_tag = "v#{$version}" open(url) do |f| content = f.read @@ -202,6 +203,8 @@ $version = ARGV[0] puts "Running checkout on OpenAPI Generator release #{$version}" +check_openapi_generator_online_docker +check_openapi_generator_cli_docker check_npmjs check_homebrew check_openapi_generator_jar @@ -211,5 +214,3 @@ check_openapi_generator_gradle_plugin_jar check_openapi_generator_online_jar check_openapi_generator_project_pom check_readme -check_openapi_generator_online_docker -check_openapi_generator_cli_docker diff --git a/bin/utils/release_version_update.sh b/bin/utils/release_version_update.sh deleted file mode 100755 index c485fc589c9..00000000000 --- a/bin/utils/release_version_update.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash -# -# usage: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1 -# -# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -if [[ "$1" != "" ]]; then - FROM="$1" -else - echo "Missing argument. Usage e.g.: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1" - exit 1; -fi - -if [[ "$2" != "" ]]; then - TO="$2" -else - echo "Missing argument. Usage e.g.: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1" - exit 1; -fi - -echo "Release preparation: replacing $FROM with $TO in different files" - -# This script assumes the files defined here have a version surrounded by angle brackets within an xml node. -# For example, >4.0.0< becomes >4.0.1-SNAPSHOT<. -# Verify the sed command below against a file before adding here. -declare -a files=("modules/openapi-generator-cli/pom.xml" - "modules/openapi-generator-gradle-plugin/pom.xml" - "modules/openapi-generator-core/pom.xml" - "modules/openapi-generator-maven-plugin/pom.xml" - "modules/openapi-generator-online/pom.xml" - "modules/openapi-generator/pom.xml" - "samples/meta-codegen/lib/pom.xml" - "pom.xml") - -sedi () { - # Cross-platform version of sed -i that works both on Mac and Linux - sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@" -} - -for filename in "${files[@]}"; do - # e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash - #echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename" - if sedi "s/>$FROM$TO
**jersey1**
HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead.
**jersey2**
HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x
**feign**
HTTP client: OpenFeign 9.x or 10.x. JSON processing: Jackson 2.8.x. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'
**okhttp-gson**
[DEFAULT] HTTP client: OkHttp 3.x. JSON processing: Gson 2.8.x. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'.
**retrofit**
HTTP client: OkHttp 2.x. JSON processing: Gson 2.x (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead.
**retrofit2**
HTTP client: OkHttp 3.x. JSON processing: Gson 2.x (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x)
**resttemplate**
HTTP client: Spring RestTemplate 4.x. JSON processing: Jackson 2.8.x
**webclient**
HTTP client: Spring WebClient 5.x. JSON processing: Jackson 2.9.x
**resteasy**
HTTP client: Resteasy client 3.x. JSON processing: Jackson 2.8.x
**vertx**
HTTP client: VertX client 3.x. JSON processing: Jackson 2.8.x
**google-api-client**
HTTP client: Google API client 1.x. JSON processing: Jackson 2.8.x
**rest-assured**
HTTP client: rest-assured : 3.x. JSON processing: Gson 2.x. Only for Java8
|okhttp-gson| diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md index 29f53a6c1ed..0c4898f8015 100644 --- a/docs/generators/kotlin-spring.md +++ b/docs/generators/kotlin-spring.md @@ -20,10 +20,11 @@ sidebar_label: kotlin-spring |serverPort|configuration the port in which the sever is to run on| |8080| |modelPackage|model package for generated code| |org.openapitools.model| |apiPackage|api package for generated code| |org.openapitools.api| -|exceptionHandler|generate default global exception handlers| |true| +|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true| |gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true| |swaggerAnnotations|generate swagger annotations to go alongside controllers and models| |false| |serviceInterface|generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern| |false| |serviceImplementation|generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated| |false| |useBeanValidation|Use BeanValidation API annotations to validate data types| |true| +|reactive|use coroutines for reactive behavior| |false| |library|library template (sub-template)|
**spring-boot**
Spring-boot Server application.
|spring-boot| diff --git a/docs/generators/nodejs-server-deprecated.md b/docs/generators/nodejs-server-deprecated.md new file mode 100644 index 00000000000..c8741e58f4c --- /dev/null +++ b/docs/generators/nodejs-server-deprecated.md @@ -0,0 +1,16 @@ + +--- +id: generator-opts-server-nodejs-server-deprecated +title: Config Options for nodejs-server-deprecated +sidebar_label: nodejs-server-deprecated +--- + +| Option | Description | Values | Default | +| ------ | ----------- | ------ | ------- | +|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true| +|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true| +|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false| +|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false| +|googleCloudFunctions|When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code.| |false| +|exportedName|When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code.| |null| +|serverPort|TCP port to listen on.| |null| diff --git a/docs/generators/spring.md b/docs/generators/spring.md index 93bff4469ad..eed7875d227 100644 --- a/docs/generators/spring.md +++ b/docs/generators/spring.md @@ -35,7 +35,7 @@ sidebar_label: spring |hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |false| |withXml|whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)| |false| |dateLibrary|Option. Date library to use|
**joda**
Joda (for legacy app only)
**legacy**
Legacy java.util.Date (if you really have a good reason not to use threetenbp
**java8-localdatetime**
Java 8 using LocalDateTime (for legacy app only)
**java8**
Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true
**threetenbp**
Backport of JSR310 (preferred for jdk < 1.8)
|threetenbp| -|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64
**false**
Various third party libraries as needed
|false| +|java8|Option. Use Java8 classes instead of third party equivalents|
**true**
Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used
**false**
Various third party libraries as needed
|false| |disableHtmlEscaping|Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields)| |false| |booleanGetterPrefix|Set booleanGetterPrefix| |get| |parentGroupId|parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect| |null| @@ -48,7 +48,6 @@ sidebar_label: spring |interfaceOnly|Whether to generate only API interface stubs without the server files.| |false| |delegatePattern|Whether to generate the server files using the delegate pattern| |false| |singleContentTypes|Whether to select only one produces/consumes content-type by operation.| |false| -|java8|use java8 default interface| |true| |async|use async Callable controllers| |false| |reactive|wrap responses in Mono/Flux Reactor types (spring-boot only)| |false| |responseWrapper|wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)| |null| diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index 269786d2750..cc3c861f1e5 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -3,7 +3,9 @@ org.openapitools openapi-generator-project + 5.0.0-SNAPSHOT + ../.. 4.0.0 diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index 62924e2b6ab..00a7f533486 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -140,7 +140,7 @@ public class Generate implements Runnable { private List typeMappings = new ArrayList<>(); @Option( - name = {"--additional-properties"}, + name = {"-p", "--additional-properties"}, title = "additional properties", description = "sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value." + " You can also have multiple occurrences of this option.") @@ -383,7 +383,10 @@ public class Generate implements Runnable { configurator.setStrictSpecBehavior(strictSpecBehavior); } - applySystemPropertiesKvpList(systemProperties, configurator); + if (systemProperties != null && !systemProperties.isEmpty()) { + System.err.println("[DEPRECATED] -D arguments after 'generate' are application arguments and not Java System Properties, please consider changing to -p, or apply your options to JAVA_OPTS, or move the -D arguments before the jar option."); + applySystemPropertiesKvpList(systemProperties, configurator); + } applyInstantiationTypesKvpList(instantiationTypes, configurator); applyImportMappingsKvpList(importMappings, configurator); applyTypeMappingsKvpList(typeMappings, configurator); diff --git a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java index d8812b5c8d1..a2304283d68 100644 --- a/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java +++ b/modules/openapi-generator-cli/src/test/java/org/openapitools/codegen/cmd/GenerateTest.java @@ -64,9 +64,11 @@ public class GenerateTest { @Test public void testRequiredArgs_ShortArgs() throws Exception { - setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null); + setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, "-p", "foo=bar"); new FullVerifications() { { + configurator.addAdditionalProperty("foo", "bar"); + times = 1; } }; } @@ -138,85 +140,6 @@ public class GenerateTest { }; } - @Test - public void testSystemProperties() throws Exception { - - setupAndRunGenericTest("-D", "hello=world,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - } - }; - - setupAndRunGenericTest("-Dhello=world,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world,key=,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world,key,foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-D", "hello=world", "-D", "key", "-D", "foo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - - setupAndRunGenericTest("-Dhello=world", "-Dkey", "-Dfoo=bar"); - - new FullVerifications() { - { - configurator.addSystemProperty("hello", "world"); - times = 1; - configurator.addSystemProperty("foo", "bar"); - times = 1; - configurator.addSystemProperty("key", ""); - times = 1; - } - }; - } - - @Test public void testConfigJson() throws Exception { diff --git a/modules/openapi-generator-core/pom.xml b/modules/openapi-generator-core/pom.xml index 0353508d252..a8d3b3e7bee 100644 --- a/modules/openapi-generator-core/pom.xml +++ b/modules/openapi-generator-core/pom.xml @@ -5,7 +5,9 @@ openapi-generator-project org.openapitools + 5.0.0-SNAPSHOT + ../.. 4.0.0 @@ -13,4 +15,27 @@ openapi-generator-core openapi-generator-core https://github.com/openapitools/openapi-generator + + + + com.google.guava + guava + ${guava-version} + + + org.slf4j + slf4j-api + ${slf4j-version} + + + org.testng + testng + test + + + + + 1.7.12 + 26.0-jre + diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java new file mode 100644 index 00000000000..6bd2588ae19 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/Context.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +/** + * The Context used for generation. + * + * @param the type of the input spec document. + */ +public class Context { + private TSpecDocument specDocument; + private GeneratorSettings generatorSettings; + private WorkflowSettings workflowSettings; + + /** + * Instantiates a new Context. + * + * @param specDocument the spec document + * @param generatorSettings the generator settings + * @param workflowSettings the workflow settings + */ + public Context(TSpecDocument specDocument, GeneratorSettings generatorSettings, WorkflowSettings workflowSettings) { + this.specDocument = specDocument; + this.generatorSettings = generatorSettings; + this.workflowSettings = workflowSettings; + } + + /** + * Gets the generator settings. These options are specific to "what" gets generated (language, framework). + * + * @return the generator settings + */ + public GeneratorSettings getGeneratorSettings() { + return generatorSettings; + } + + /** + * Gets the spec document. + * + * @return the spec document + */ + public TSpecDocument getSpecDocument() { + return specDocument; + } + + /** + * Gets the workflow settings. These options are specific to "how" code gets generated (input, output directory, ignore files, template engine, etc). + * + * @return the workflow settings + */ + public WorkflowSettings getWorkflowSettings() { + return workflowSettings; + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java new file mode 100644 index 00000000000..565539c7ca3 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/GeneratorSettings.java @@ -0,0 +1,872 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.Serializable; +import java.util.*; + +/** + * Represents those settings applied to a generator. + */ +public final class GeneratorSettings implements Serializable { + + private static final Logger LOGGER = LoggerFactory.getLogger(GeneratorSettings.class); + private static String DEFAULT_GIT_USER_ID = "GIT_USER_ID"; + private static String DEFAULT_GIT_REPO_ID = "GIT_REPO_ID"; + private static String DEFAULT_RELEASE_NOTE = "Minor update"; + + private String generatorName; + private String apiPackage; + private String modelPackage; + private String invokerPackage; + private String packageName; + private String modelNamePrefix; + private String modelNameSuffix; + private String groupId; + private String artifactId; + private String artifactVersion; + private String library; + + private ImmutableMap instantiationTypes; + private ImmutableMap typeMappings; + private ImmutableMap additionalProperties; + private ImmutableMap importMappings; + private ImmutableSet languageSpecificPrimitives; + private ImmutableMap reservedWordMappings; + + private String gitUserId; + private String gitRepoId; + private String releaseNote; + private String httpUserAgent; + + /** + * Gets the name of the generator to use. + * + * @return the generator name + */ + public String getGeneratorName() { + return generatorName; + } + + /** + * Gets the api package name for generated sources. + * + * @return the api package + */ + public String getApiPackage() { + return apiPackage; + } + + /** + * Gets the model package name for generated sources + * + * @return the model package + */ + public String getModelPackage() { + return modelPackage; + } + + /** + * Gets the invoker package name for generated sources. + * + * @return the invoker package + */ + public String getInvokerPackage() { + return invokerPackage; + } + + /** + * Gets the overall package name for generated sources. + * + * @return the package name + */ + public String getPackageName() { + return packageName; + } + + /** + * Gets a model name prefix for generated models. This name will be prefixed to a model name. + *

+ * This option is often used to circumvent compilation issues where models match keywords. + *

+ * Example: + *

+ * Prefix My applied to Object results in a generated class named MyObject. + * + * @return the model name prefix + */ + public String getModelNamePrefix() { + return modelNamePrefix; + } + + /** + * Gets a model name suffix for generated models. This name will be appended to a model name. + *

+ * This option is often used to circumvent compilation issues where models match keywords. + *

+ * Example: + *

+ * Suffix Gen applied to Object results in a generated class named ObjectGen. + * + * @return the model name suffix + */ + public String getModelNameSuffix() { + return modelNameSuffix; + } + + /** + * Gets the group id for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the group id + */ + public String getGroupId() { + return groupId; + } + + /** + * Gets artifact id for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the artifact id + */ + public String getArtifactId() { + return artifactId; + } + + /** + * Gets artifact version for generated sources which support this concept (e.g. Java and pom.xml, Scala and SBT/Gradle/pom). + * + * @return the artifact version + */ + public String getArtifactVersion() { + return artifactVersion; + } + + /** + * Gets library (sub-template) for the target generated. + * + * @return the library + */ + public String getLibrary() { + return library; + } + + + /** + * Gets instantiation types mappings. These allow for customizing the defaults provided by a built-in generator. + *

+ * For example, "array" to "ArrayList" applied to the Java generator will cause all array properties to be instantiated as ArrayList. + *

+ * This option differs from {@link GeneratorSettings#getTypeMappings()} in that values provided here are generally used for type construction (what is applied to "new"). + * + * @return the instantiation types + */ + public Map getInstantiationTypes() { + return instantiationTypes; + } + + /** + * Gets type mappings. These allow for customizing type definitions. + *

+ * For example, "array" to "List" applied to the Java generator will cause all variable assignments for array properties to be of type List. + *

+ * This option differs from {@link GeneratorSettings#getInstantiationTypes()} in that values provided here are variable reference types rather than concrete instantiation types. + * + * @return the type mappings + */ + public Map getTypeMappings() { + return typeMappings; + } + + /** + * Gets additional properties which will be passed to template as dynamic properties. + * + * @return the additional properties + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Gets import mappings between a given class and the import that should be used for that class. + *

+ * Use import mappings, for example, when you want to "bring your own models" from another location. + * + * @return the import mappings + * @see Bringing your own models + */ + public Map getImportMappings() { + return importMappings; + } + + /** + * Gets language specific primitives. These are in addition to the "base" primitives defined in a generator. + *

+ * In general, a primitive defined here will indicate to the generator: + *

+ * - models with these types don't require an import + * - model names not included here require imports and likely indicate a model reference + *

+ * There may be generator-specific implementation details which differ slightly. + * + * @return the language specific primitives + */ + public Set getLanguageSpecificPrimitives() { + return languageSpecificPrimitives; + } + + /** + * Gets reserved word mappings. Values defined here define how a reserved word should be escaped. + *

+ * If no mapping is present, the mapping is generally automatically applied to a default with prefixed underscore (_name). Note that + * some languages don't support identifiers beginning with a prefix, in which case the generator applies a more appropriate prefix. + * + * @return the reserved word mappings + */ + public Map getReservedWordMappings() { + return reservedWordMappings; + } + + /** + * Gets git user id. e.g. openapitools. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the git user id + */ + public String getGitUserId() { + return gitUserId; + } + + /** + * Gets git repo id. e.g. openapi-generator. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the git repo id + */ + public String getGitRepoId() { + return gitRepoId; + } + + /** + * Gets release note for the generated instance. + *

+ * Generally used by git_push.sh in generated sources which support it. + * This value may also be used by templates in maven style references, READMEs, or other documentation. + * + * @return the release note + */ + public String getReleaseNote() { + return releaseNote; + } + + /** + * Gets the http user agent to be used by client generators which support setting this value. + *

+ * e.g. codegen_csharp_api_client, defaults to 'OpenAPI-Generator/{packageVersion}}/{language}' + * + * @return the http user agent + */ + public String getHttpUserAgent() { + return httpUserAgent; + } + + private GeneratorSettings(Builder builder) { + setDefaults(); + + generatorName = builder.generatorName; + apiPackage = builder.apiPackage; + modelPackage = builder.modelPackage; + invokerPackage = builder.invokerPackage; + packageName = builder.packageName; + modelNamePrefix = builder.modelNamePrefix; + modelNameSuffix = builder.modelNameSuffix; + groupId = builder.groupId; + artifactId = builder.artifactId; + artifactVersion = builder.artifactVersion; + library = builder.library; + instantiationTypes = ImmutableMap.copyOf(builder.instantiationTypes); + typeMappings = ImmutableMap.copyOf(builder.typeMappings); + importMappings = ImmutableMap.copyOf(builder.importMappings); + languageSpecificPrimitives = ImmutableSet.copyOf(builder.languageSpecificPrimitives); + reservedWordMappings = ImmutableMap.copyOf(builder.reservedWordMappings); + gitUserId = builder.gitUserId; + gitRepoId = builder.gitRepoId; + releaseNote = builder.releaseNote; + httpUserAgent = builder.httpUserAgent; + + Map additional = new HashMap<>(builder.additionalProperties); + + if (isNotEmpty(apiPackage)) { + additional.put("apiPackage", apiPackage); + } + if (isNotEmpty(modelPackage)) { + additional.put("modelPackage", modelPackage); + } + if (isNotEmpty(invokerPackage)) { + additional.put("invokerPackage", invokerPackage); + } + if (isNotEmpty(packageName)) { + additional.put("packageName", packageName); + } + if (isNotEmpty(groupId)) { + additional.put("groupId", groupId); + } + if (isNotEmpty(artifactId)) { + additional.put("artifactId", artifactId); + } + if (isNotEmpty(artifactVersion)) { + additional.put("artifactVersion", artifactVersion); + } + if (isNotEmpty(modelNamePrefix)) { + additional.put("modelNamePrefix", modelNamePrefix); + } + if (isNotEmpty(modelNameSuffix)) { + additional.put("modelNameSuffix", modelNameSuffix); + } + if (isNotEmpty(gitUserId)) { + additional.put("gitUserId", gitUserId); + } + if (isNotEmpty(gitRepoId)) { + additional.put("gitRepoId", gitRepoId); + } + if (isNotEmpty(releaseNote)) { + additional.put("releaseNote", releaseNote); + } + if (isNotEmpty(httpUserAgent)) { + additional.put("httpUserAgent", httpUserAgent); + } + + additionalProperties = ImmutableMap.copyOf(additional); + } + + /** + * Instantiates a new Generator settings. + */ + @SuppressWarnings("unused") + public GeneratorSettings() { + setDefaults(); + instantiationTypes = ImmutableMap.of(); + typeMappings = ImmutableMap.of(); + additionalProperties = ImmutableMap.of(); + importMappings = ImmutableMap.of(); + languageSpecificPrimitives = ImmutableSet.of(); + reservedWordMappings = ImmutableMap.of(); + } + + private void setDefaults() { + gitUserId = DEFAULT_GIT_USER_ID; + gitRepoId = DEFAULT_GIT_REPO_ID; + releaseNote = DEFAULT_RELEASE_NOTE; + } + + private boolean isNotEmpty(String value) { + return value != null && value.length() > 0; + } + + /** + * New builder builder. + * + * @return the builder + */ + public static Builder newBuilder() { + return new Builder(); + } + + /** + * New builder builder. + * + * @param copy the copy + * @return the builder + */ + public static Builder newBuilder(GeneratorSettings copy) { + Builder builder = new Builder(); + builder.generatorName = copy.getGeneratorName(); + builder.apiPackage = copy.getApiPackage(); + builder.modelPackage = copy.getModelPackage(); + builder.invokerPackage = copy.getInvokerPackage(); + builder.packageName = copy.getPackageName(); + builder.modelNamePrefix = copy.getModelNamePrefix(); + builder.modelNameSuffix = copy.getModelNameSuffix(); + builder.groupId = copy.getGroupId(); + builder.artifactId = copy.getArtifactId(); + builder.artifactVersion = copy.getArtifactVersion(); + builder.library = copy.getLibrary(); + builder.instantiationTypes = new HashMap<>(copy.getInstantiationTypes()); + builder.typeMappings = new HashMap<>(copy.getTypeMappings()); + builder.additionalProperties = new HashMap<>(copy.getAdditionalProperties()); + builder.importMappings = new HashMap<>(copy.getImportMappings()); + builder.languageSpecificPrimitives = new HashSet<>(copy.getLanguageSpecificPrimitives()); + builder.reservedWordMappings = new HashMap<>(copy.getReservedWordMappings()); + builder.gitUserId = copy.getGitUserId(); + builder.gitRepoId = copy.getGitRepoId(); + builder.releaseNote = copy.getReleaseNote(); + builder.httpUserAgent = copy.getHttpUserAgent(); + + return builder; + } + + /** + * {@code GeneratorSettings} builder static inner class. + */ + @SuppressWarnings("UnusedReturnValue") + public static final class Builder { + private String generatorName; + private String apiPackage; + private String modelPackage; + private String invokerPackage; + private String packageName; + private String modelNamePrefix; + private String modelNameSuffix; + private String groupId; + private String artifactId; + private String artifactVersion; + private String library; + private Map instantiationTypes; + private Map typeMappings; + private Map additionalProperties; + private Map importMappings; + private Set languageSpecificPrimitives; + private Map reservedWordMappings; + private String gitUserId; + private String gitRepoId; + private String releaseNote; + private String httpUserAgent; + + /** + * Instantiates a new Builder. + */ + public Builder() { + instantiationTypes = new HashMap<>(); + typeMappings = new HashMap<>(); + additionalProperties = new HashMap<>(); + importMappings = new HashMap<>(); + languageSpecificPrimitives = new HashSet<>(); + reservedWordMappings = new HashMap<>(); + + gitUserId = DEFAULT_GIT_USER_ID; + gitRepoId = DEFAULT_GIT_REPO_ID; + releaseNote = DEFAULT_RELEASE_NOTE; + } + + /** + * Sets the {@code generatorName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param generatorName the {@code generatorName} to set + * @return a reference to this Builder + */ + public Builder withGeneratorName(String generatorName) { + this.generatorName = generatorName; + return this; + } + + /** + * Sets the {@code apiPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param apiPackage the {@code apiPackage} to set + * @return a reference to this Builder + */ + public Builder withApiPackage(String apiPackage) { + this.apiPackage = apiPackage; + return this; + } + + /** + * Sets the {@code modelPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelPackage the {@code modelPackage} to set + * @return a reference to this Builder + */ + public Builder withModelPackage(String modelPackage) { + this.modelPackage = modelPackage; + return this; + } + + /** + * Sets the {@code invokerPackage} and returns a reference to this Builder so that the methods can be chained together. + * + * @param invokerPackage the {@code invokerPackage} to set + * @return a reference to this Builder + */ + public Builder withInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + return this; + } + + /** + * Sets the {@code packageName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param packageName the {@code packageName} to set + * @return a reference to this Builder + */ + public Builder withPackageName(String packageName) { + this.packageName = packageName; + return this; + } + + /** + * Sets the {@code modelNamePrefix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelNamePrefix the {@code modelNamePrefix} to set + * @return a reference to this Builder + */ + public Builder withModelNamePrefix(String modelNamePrefix) { + this.modelNamePrefix = modelNamePrefix; + return this; + } + + /** + * Sets the {@code modelNameSuffix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param modelNameSuffix the {@code modelNameSuffix} to set + * @return a reference to this Builder + */ + public Builder withModelNameSuffix(String modelNameSuffix) { + this.modelNameSuffix = modelNameSuffix; + return this; + } + + /** + * Sets the {@code groupId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param groupId the {@code groupId} to set + * @return a reference to this Builder + */ + public Builder withGroupId(String groupId) { + this.groupId = groupId; + return this; + } + + /** + * Sets the {@code artifactId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param artifactId the {@code artifactId} to set + * @return a reference to this Builder + */ + public Builder withArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + /** + * Sets the {@code artifactVersion} and returns a reference to this Builder so that the methods can be chained together. + * + * @param artifactVersion the {@code artifactVersion} to set + * @return a reference to this Builder + */ + public Builder withArtifactVersion(String artifactVersion) { + this.artifactVersion = artifactVersion; + return this; + } + + /** + * Sets the {@code library} and returns a reference to this Builder so that the methods can be chained together. + * + * @param library the {@code library} to set + * @return a reference to this Builder + */ + public Builder withLibrary(String library) { + this.library = library; + return this; + } + + /** + * Sets the {@code instantiationTypes} and returns a reference to this Builder so that the methods can be chained together. + * + * @param instantiationTypes the {@code instantiationTypes} to set + * @return a reference to this Builder + */ + public Builder withInstantiationTypes(Map instantiationTypes) { + this.instantiationTypes = instantiationTypes; + return this; + } + + /** + * Sets a single {@code instantiationTypes} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some instantiation type + * @param value The value of some instantiation type + * @return a reference to this Builder + */ + public Builder withInstantiationType(String key, String value) { + if (this.instantiationTypes == null) { + this.instantiationTypes = new HashMap<>(); + } + this.instantiationTypes.put(key, value); + return this; + } + + /** + * Sets the {@code typeMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param typeMappings the {@code typeMappings} to set + * @return a reference to this Builder + */ + public Builder withTypeMappings(Map typeMappings) { + this.typeMappings = typeMappings; + return this; + } + + /** + * Sets the {@code additionalProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param additionalProperties the {@code additionalProperties} to set + * @return a reference to this Builder + */ + public Builder withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Sets the {@code additionalProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some additional property + * @param value The value of some additional property + * @return a reference to this Builder + */ + public Builder withAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap<>(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Sets the {@code importMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param importMappings the {@code importMappings} to set + * @return a reference to this Builder + */ + public Builder withImportMappings(Map importMappings) { + this.importMappings = importMappings; + return this; + } + + /** + * Sets a single {@code importMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some import mapping + * @param value The value of some import mapping + * @return a reference to this Builder + */ + public Builder withImportMapping(String key, String value) { + if (this.importMappings == null) { + this.importMappings = new HashMap<>(); + } + this.importMappings.put(key, value); + return this; + } + + /** + * Sets the {@code languageSpecificPrimitives} and returns a reference to this Builder so that the methods can be chained together. + * + * @param languageSpecificPrimitives the {@code languageSpecificPrimitives} to set + * @return a reference to this Builder + */ + public Builder withLanguageSpecificPrimitives(Set languageSpecificPrimitives) { + this.languageSpecificPrimitives = languageSpecificPrimitives; + return this; + } + + /** + * Sets a single {@code languageSpecificPrimitives} and returns a reference to this Builder so that the methods can be chained together. + * + * @param value The value of some primitive to set + * @return a reference to this Builder + */ + public Builder withLanguageSpecificPrimitive(String value) { + if (this.languageSpecificPrimitives == null) { + this.languageSpecificPrimitives = new HashSet<>(); + } + this.languageSpecificPrimitives.add(value); + return this; + } + + /** + * Sets the {@code reservedWordMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param reservedWordMappings the {@code reservedWordMappings} to set + * @return a reference to this Builder + */ + public Builder withReservedWordMappings(Map reservedWordMappings) { + this.reservedWordMappings = reservedWordMappings; + return this; + } + + /** + * Sets a single {@code reservedWordMappings} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key A key for some reserved word mapping + * @param value The value of some reserved word mapping + * @return a reference to this Builder + */ + public Builder withReservedWordMapping(String key, String value) { + if (this.reservedWordMappings == null) { + this.reservedWordMappings = new HashMap<>(); + } + this.reservedWordMappings.put(key, value); + return this; + } + + /** + * Sets the {@code gitUserId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param gitUserId the {@code gitUserId} to set + * @return a reference to this Builder + */ + public Builder withGitUserId(String gitUserId) { + this.gitUserId = gitUserId; + return this; + } + + /** + * Sets the {@code gitRepoId} and returns a reference to this Builder so that the methods can be chained together. + * + * @param gitRepoId the {@code gitRepoId} to set + * @return a reference to this Builder + */ + public Builder withGitRepoId(String gitRepoId) { + this.gitRepoId = gitRepoId; + return this; + } + + /** + * Sets the {@code releaseNote} and returns a reference to this Builder so that the methods can be chained together. + * + * @param releaseNote the {@code releaseNote} to set + * @return a reference to this Builder + */ + public Builder withReleaseNote(String releaseNote) { + this.releaseNote = releaseNote; + return this; + } + + /** + * Sets the {@code httpUserAgent} and returns a reference to this Builder so that the methods can be chained together. + * + * @param httpUserAgent the {@code httpUserAgent} to set + * @return a reference to this Builder + */ + public Builder withHttpUserAgent(String httpUserAgent) { + this.httpUserAgent = httpUserAgent; + return this; + } + + /** + * Returns a {@code GeneratorSettings} built from the parameters previously set. + * + * @return a {@code GeneratorSettings} built with parameters of this {@code GeneratorSettings.Builder} + */ + public GeneratorSettings build() { + GeneratorSettings instance = new GeneratorSettings(this); + //noinspection PlaceholderCountMatchesArgumentCount + LOGGER.debug("GeneratorSettings#build: %s", instance.toString()); + return instance; + } + } + + @Override + public String toString() { + return "GeneratorSettings{" + + "generatorName='" + generatorName + '\'' + + ", apiPackage='" + apiPackage + '\'' + + ", modelPackage='" + modelPackage + '\'' + + ", invokerPackage='" + invokerPackage + '\'' + + ", packageName='" + packageName + '\'' + + ", modelNamePrefix='" + modelNamePrefix + '\'' + + ", modelNameSuffix='" + modelNameSuffix + '\'' + + ", groupId='" + groupId + '\'' + + ", artifactId='" + artifactId + '\'' + + ", artifactVersion='" + artifactVersion + '\'' + + ", library='" + library + '\'' + + ", instantiationTypes=" + instantiationTypes + + ", typeMappings=" + typeMappings + + ", additionalProperties=" + additionalProperties + + ", importMappings=" + importMappings + + ", languageSpecificPrimitives=" + languageSpecificPrimitives + + ", reservedWordMappings=" + reservedWordMappings + + ", gitUserId='" + gitUserId + '\'' + + ", gitRepoId='" + gitRepoId + '\'' + + ", releaseNote='" + releaseNote + '\'' + + ", httpUserAgent='" + httpUserAgent + '\'' + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof GeneratorSettings)) return false; + GeneratorSettings that = (GeneratorSettings) o; + return Objects.equals(getGeneratorName(), that.getGeneratorName()) && + Objects.equals(getApiPackage(), that.getApiPackage()) && + Objects.equals(getModelPackage(), that.getModelPackage()) && + Objects.equals(getInvokerPackage(), that.getInvokerPackage()) && + Objects.equals(getPackageName(), that.getPackageName()) && + Objects.equals(getModelNamePrefix(), that.getModelNamePrefix()) && + Objects.equals(getModelNameSuffix(), that.getModelNameSuffix()) && + Objects.equals(getGroupId(), that.getGroupId()) && + Objects.equals(getArtifactId(), that.getArtifactId()) && + Objects.equals(getArtifactVersion(), that.getArtifactVersion()) && + Objects.equals(getLibrary(), that.getLibrary()) && + Objects.equals(getInstantiationTypes(), that.getInstantiationTypes()) && + Objects.equals(getTypeMappings(), that.getTypeMappings()) && + Objects.equals(getAdditionalProperties(), that.getAdditionalProperties()) && + Objects.equals(getImportMappings(), that.getImportMappings()) && + Objects.equals(getLanguageSpecificPrimitives(), that.getLanguageSpecificPrimitives()) && + Objects.equals(getReservedWordMappings(), that.getReservedWordMappings()) && + Objects.equals(getGitUserId(), that.getGitUserId()) && + Objects.equals(getGitRepoId(), that.getGitRepoId()) && + Objects.equals(getReleaseNote(), that.getReleaseNote()) && + Objects.equals(getHttpUserAgent(), that.getHttpUserAgent()); + } + + @Override + public int hashCode() { + return Objects.hash( + getGeneratorName(), + getApiPackage(), + getModelPackage(), + getInvokerPackage(), + getPackageName(), + getModelNamePrefix(), + getModelNameSuffix(), + getGroupId(), + getArtifactId(), + getArtifactVersion(), + getLibrary(), + getInstantiationTypes(), + getTypeMappings(), + getAdditionalProperties(), + getImportMappings(), + getLanguageSpecificPrimitives(), + getReservedWordMappings(), + getGitUserId(), + getGitRepoId(), + getReleaseNote(), + getHttpUserAgent() + ); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java new file mode 100644 index 00000000000..2f506ac15ff --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/config/WorkflowSettings.java @@ -0,0 +1,534 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.config; + +import com.google.common.collect.ImmutableMap; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Represents those settings applied to a generation workflow. + */ +@SuppressWarnings("WeakerAccess") +public class WorkflowSettings { + + private static final Logger LOGGER = LoggerFactory.getLogger(WorkflowSettings.class); + + private String inputSpec; + private String outputDir; + private boolean verbose; + private boolean skipOverwrite; + private boolean removeOperationIdPrefix; + private boolean logToStderr; + private boolean validateSpec; + private boolean enablePostProcessFile; + private boolean enableMinimalUpdate; + private boolean strictSpecBehavior; + private String templateDir; + private String templatingEngineName; + private String ignoreFileOverride; + private ImmutableMap systemProperties; + + private WorkflowSettings(Builder builder) { + setDefaults(); + inputSpec = builder.inputSpec; + outputDir = builder.outputDir; + verbose = builder.verbose; + skipOverwrite = builder.skipOverwrite; + removeOperationIdPrefix = builder.removeOperationIdPrefix; + logToStderr = builder.logToStderr; + validateSpec = builder.validateSpec; + enablePostProcessFile = builder.enablePostProcessFile; + enableMinimalUpdate = builder.enableMinimalUpdate; + strictSpecBehavior = builder.strictSpecBehavior; + templateDir = builder.templateDir; + templatingEngineName = builder.templatingEngineName; + ignoreFileOverride = builder.ignoreFileOverride; + systemProperties = ImmutableMap.copyOf(builder.systemProperties); + } + + /** + * Instantiates a new workflow settings. + */ + @SuppressWarnings("unused") + public WorkflowSettings() { + setDefaults(); + systemProperties = ImmutableMap.of(); + } + + private void setDefaults(){ + validateSpec = true; + strictSpecBehavior = true; + outputDir = "."; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public static Builder newBuilder(WorkflowSettings copy) { + Builder builder = new Builder(); + builder.inputSpec = copy.getInputSpec(); + builder.outputDir = copy.getOutputDir(); + builder.verbose = copy.isVerbose(); + builder.skipOverwrite = copy.isSkipOverwrite(); + builder.removeOperationIdPrefix = copy.isRemoveOperationIdPrefix(); + builder.logToStderr = copy.isLogToStderr(); + builder.validateSpec = copy.isValidateSpec(); + builder.enablePostProcessFile = copy.isEnablePostProcessFile(); + builder.enableMinimalUpdate = copy.isEnableMinimalUpdate(); + builder.strictSpecBehavior = copy.isStrictSpecBehavior(); + builder.templatingEngineName = copy.getTemplatingEngineName(); + builder.ignoreFileOverride = copy.getIgnoreFileOverride(); + builder.systemProperties = ImmutableMap.copyOf(copy.getSystemProperties()); + + // force builder "with" methods to invoke side effects + builder.withTemplateDir(copy.getTemplateDir()); + + return builder; + } + + /** + * Gets input spec's location, as URL or file + * + * @return the input spec + */ + public String getInputSpec() { + return inputSpec; + } + + /** + * Gets the output dir (where we write generated files). Defaults to the current directory. + * + * @return the output dir + */ + public String getOutputDir() { + return outputDir; + } + + /** + * Configures verbosity of generation. When true, more messages will be printed during generation. + * + * @return true if verbose mode, false otherwise. + */ + public boolean isVerbose() { + return verbose; + } + + /** + * Indicates whether or not the existing files should be overwritten during the generation. This option is more rudimentary than + * defining patterns in .openapi-generator-ignore or {@link WorkflowSettings#isEnableMinimalUpdate()}. + * + * @return true if defaulting to overwriting files, false otherwise. + * @see Ignore File Format + */ + public boolean isSkipOverwrite() { + return skipOverwrite; + } + + /** + * Indicates whether or not to remove the prefix of operationId, e.g. config_getId to getId. + * + * @return true if the operation id prefix should be removed during generation, false otherwise. + */ + public boolean isRemoveOperationIdPrefix() { + return removeOperationIdPrefix; + } + + /** + * Indicates whether or not the generator's executor will write all log messages (not just errors) to STDOUT. Useful for + * piping the JSON output of debug options (e.g. -DdebugOperations) to an external parser directly while testing a generator. + * + * @return true if the executor should attempt to write all messages to stderr, + * false otherwise (which defaults to logging configuration, not necessarily stdout). + */ + public boolean isLogToStderr() { + return logToStderr; + } + + /** + * Indicates whether or not generation should also validate an input specification. + *

+ * NOTE: Invalid specs may result in a generation error, disabling may cause unexpected results. + * + * @return true if spec document validation is enabled, otherwise false. Default: true. + */ + public boolean isValidateSpec() { + return validateSpec; + } + + /** + * Indicates whether or not file post-processing is enabled for generators which support it. Refer to individual generator documentation for details. + *

+ * In general, once enabled, a generator will evaluate a command stored in LANG_POST_PROCESS_FILE. + *

+ * For example: + * + * export SCALA_POST_PROCESS_FILE=/usr/local/bin/scalafmt + *

+ * Here, a Scala generator which supports file post-processing will run scalafmt for each generated file. + * + * @return true if file post-processing is enabled, otherwise false. + */ + public boolean isEnablePostProcessFile() { + return enablePostProcessFile; + } + + /** + * Indicates whether or not the generation should update only those files which have changed. + * + * @return true if minimal updates are enabled, otherwise false. + */ + public boolean isEnableMinimalUpdate() { + return enableMinimalUpdate; + } + + /** + * Indicates whether or not 'MUST' and 'SHALL' wording in the api specification is strictly adhered to. + * For example, when false, no automatic 'fixes' will be applied to documents which pass validation but don't follow the spec. + * + * @return true if the generator should attempt to strictly follow rules in the specification, otherwise false. + */ + public boolean isStrictSpecBehavior() { + return strictSpecBehavior; + } + + /** + * Gets the directory holding templates used in generation. This option allows users to extend or modify built-in templates, or to write their own. + * + * @return the template dir + */ + public String getTemplateDir() { + return templateDir; + } + + /** + * Gets the name of the templating engine to target. This option allows a user to target an engine which differs from the generator default, or to + * refer to their own fully qualified type name of a custom template engine adapter. + * + * @return the templating engine name + * @see Custom Engines + */ + public String getTemplatingEngineName() { + return templatingEngineName; + } + + /** + * Gets the override location for the .openapi-generator-ignore file. Most useful on initial generation. + * + * @return the ignore file override + */ + public String getIgnoreFileOverride() { + return ignoreFileOverride; + } + + /** + * Gets system properties applied to the generator. + * + * @return the system properties + */ + public Map getSystemProperties() { + return systemProperties; + } + + /** + * {@code WorkflowSettings} builder static inner class. + */ + @SuppressWarnings("unused") + public static final class Builder { + private String inputSpec; + private String outputDir; + private boolean verbose; + private boolean skipOverwrite; + private boolean removeOperationIdPrefix; + private boolean logToStderr; + private boolean validateSpec; + private boolean enablePostProcessFile; + private boolean enableMinimalUpdate; + private boolean strictSpecBehavior; + private String templateDir; + private String templatingEngineName; + private String ignoreFileOverride; + private Map systemProperties; + + private Builder() { + systemProperties = new HashMap<>(); + } + + /** + * Sets the {@code inputSpec} and returns a reference to this Builder so that the methods can be chained together. + * + * @param inputSpec the {@code inputSpec} to set + * @return a reference to this Builder + */ + public Builder withInputSpec(String inputSpec) { + this.inputSpec = inputSpec; + return this; + } + + /** + * Sets the {@code outputDir} and returns a reference to this Builder so that the methods can be chained together. + * + * @param outputDir the {@code outputDir} to set + * @return a reference to this Builder + */ + public Builder withOutputDir(String outputDir) { + this.outputDir = Paths.get(outputDir).toAbsolutePath().toString();; + return this; + } + + /** + * Sets the {@code verbose} and returns a reference to this Builder so that the methods can be chained together. + * + * @param verbose the {@code verbose} to set + * @return a reference to this Builder + */ + public Builder withVerbose(boolean verbose) { + this.verbose = verbose; + return this; + } + + /** + * Sets the {@code skipOverwrite} and returns a reference to this Builder so that the methods can be chained together. + * + * @param skipOverwrite the {@code skipOverwrite} to set + * @return a reference to this Builder + */ + public Builder withSkipOverwrite(boolean skipOverwrite) { + this.skipOverwrite = skipOverwrite; + return this; + } + + /** + * Sets the {@code removeOperationIdPrefix} and returns a reference to this Builder so that the methods can be chained together. + * + * @param removeOperationIdPrefix the {@code removeOperationIdPrefix} to set + * @return a reference to this Builder + */ + public Builder withRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { + this.removeOperationIdPrefix = removeOperationIdPrefix; + return this; + } + + /** + * Sets the {@code logToStderr} and returns a reference to this Builder so that the methods can be chained together. + * + * @param logToStderr the {@code logToStderr} to set + * @return a reference to this Builder + */ + public Builder withLogToStderr(boolean logToStderr) { + this.logToStderr = logToStderr; + return this; + } + + /** + * Sets the {@code validateSpec} and returns a reference to this Builder so that the methods can be chained together. + * + * @param validateSpec the {@code validateSpec} to set + * @return a reference to this Builder + */ + public Builder withValidateSpec(boolean validateSpec) { + this.validateSpec = validateSpec; + return this; + } + + /** + * Sets the {@code enablePostProcessFile} and returns a reference to this Builder so that the methods can be chained together. + * + * @param enablePostProcessFile the {@code enablePostProcessFile} to set + * @return a reference to this Builder + */ + public Builder withEnablePostProcessFile(boolean enablePostProcessFile) { + this.enablePostProcessFile = enablePostProcessFile; + return this; + } + + /** + * Sets the {@code enableMinimalUpdate} and returns a reference to this Builder so that the methods can be chained together. + * + * @param enableMinimalUpdate the {@code enableMinimalUpdate} to set + * @return a reference to this Builder + */ + public Builder withEnableMinimalUpdate(boolean enableMinimalUpdate) { + this.enableMinimalUpdate = enableMinimalUpdate; + return this; + } + + /** + * Sets the {@code strictSpecBehavior} and returns a reference to this Builder so that the methods can be chained together. + * + * @param strictSpecBehavior the {@code strictSpecBehavior} to set + * @return a reference to this Builder + */ + public Builder withStrictSpecBehavior(boolean strictSpecBehavior) { + this.strictSpecBehavior = strictSpecBehavior; + return this; + } + + /** + * Sets the {@code templateDir} and returns a reference to this Builder so that the methods can be chained together. + * + * @param templateDir the {@code templateDir} to set + * @return a reference to this Builder + */ + public Builder withTemplateDir(String templateDir) { + if (templateDir == null) { + this.templateDir = null; + } else { + File f = new File(templateDir); + + // check to see if the folder exists + if (!(f.exists() && f.isDirectory())) { + throw new IllegalArgumentException( + "Template directory " + templateDir + " does not exist."); + } + + this.templateDir = Paths.get(f.toURI()).toAbsolutePath().toString(); + } + + return this; + } + + /** + * Sets the {@code templatingEngineName} and returns a reference to this Builder so that the methods can be chained together. + * + * @param templatingEngineName the {@code templatingEngineName} to set + * @return a reference to this Builder + */ + public Builder withTemplatingEngineName(String templatingEngineName) { + this.templatingEngineName = templatingEngineName; + return this; + } + + /** + * Sets the {@code ignoreFileOverride} and returns a reference to this Builder so that the methods can be chained together. + * + * @param ignoreFileOverride the {@code ignoreFileOverride} to set + * @return a reference to this Builder + */ + public Builder withIgnoreFileOverride(String ignoreFileOverride) { + this.ignoreFileOverride = ignoreFileOverride; + return this; + } + + /** + * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param systemProperties the {@code systemProperties} to set + * @return a reference to this Builder + */ + public Builder withSystemProperties(Map systemProperties) { + this.systemProperties = systemProperties; + return this; + } + + /** + * Sets the {@code systemProperties} and returns a reference to this Builder so that the methods can be chained together. + * + * @param key The key of a system (global) property to set + * @param value The value of a system (global) property to set + * @return a reference to this Builder + */ + public Builder withSystemProperty(String key, String value) { + if (this.systemProperties == null) { + this.systemProperties = new HashMap<>(); + } + this.systemProperties.put(key, value); + return this; + } + + /** + * Returns a {@code WorkflowSettings} built from the parameters previously set. + * + * @return a {@code WorkflowSettings} built with parameters of this {@code WorkflowSettings.Builder} + */ + public WorkflowSettings build() { + WorkflowSettings instance = new WorkflowSettings(this); + //noinspection PlaceholderCountMatchesArgumentCount + LOGGER.debug("WorkflowSettings#build: %s", instance.toString()); + return instance; + } + } + + + @Override + public String toString() { + return "WorkflowSettings{" + + "inputSpec='" + inputSpec + '\'' + + ", outputDir='" + outputDir + '\'' + + ", verbose=" + verbose + + ", skipOverwrite=" + skipOverwrite + + ", removeOperationIdPrefix=" + removeOperationIdPrefix + + ", logToStderr=" + logToStderr + + ", validateSpec=" + validateSpec + + ", enablePostProcessFile=" + enablePostProcessFile + + ", enableMinimalUpdate=" + enableMinimalUpdate + + ", strictSpecBehavior=" + strictSpecBehavior + + ", templateDir='" + templateDir + '\'' + + ", templatingEngineName='" + templatingEngineName + '\'' + + ", ignoreFileOverride='" + ignoreFileOverride + '\'' + + ", systemProperties=" + systemProperties + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof WorkflowSettings)) return false; + WorkflowSettings that = (WorkflowSettings) o; + return isVerbose() == that.isVerbose() && + isSkipOverwrite() == that.isSkipOverwrite() && + isRemoveOperationIdPrefix() == that.isRemoveOperationIdPrefix() && + isLogToStderr() == that.isLogToStderr() && + isValidateSpec() == that.isValidateSpec() && + isEnablePostProcessFile() == that.isEnablePostProcessFile() && + isEnableMinimalUpdate() == that.isEnableMinimalUpdate() && + isStrictSpecBehavior() == that.isStrictSpecBehavior() && + Objects.equals(getInputSpec(), that.getInputSpec()) && + Objects.equals(getOutputDir(), that.getOutputDir()) && + Objects.equals(getTemplateDir(), that.getTemplateDir()) && + Objects.equals(getTemplatingEngineName(), that.getTemplatingEngineName()) && + Objects.equals(getIgnoreFileOverride(), that.getIgnoreFileOverride()) && + Objects.equals(getSystemProperties(), that.getSystemProperties()); + } + + @Override + public int hashCode() { + return Objects.hash( + getInputSpec(), + getOutputDir(), + isVerbose(), + isSkipOverwrite(), + isRemoveOperationIdPrefix(), + isLogToStderr(), + isValidateSpec(), + isEnablePostProcessFile(), + isEnableMinimalUpdate(), + isStrictSpecBehavior(), + getTemplateDir(), + getTemplatingEngineName(), + getIgnoreFileOverride(), + getSystemProperties() + ); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java index 0c87104c7b5..4bd538a231d 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/GeneratorMetadata.java @@ -1,3 +1,19 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openapitools.codegen.meta; /** diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java index 6e12c64f7d1..8547ea9b10d 100644 --- a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/meta/Stability.java @@ -1,3 +1,19 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openapitools.codegen.meta; /** diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/GenericValidator.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/GenericValidator.java new file mode 100644 index 00000000000..2cac0876053 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/GenericValidator.java @@ -0,0 +1,61 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import java.util.List; + +/** + * A generic implementation of a validator instance which simply applies rules to an input instance. + * + * @param The type of object being evaluated. + */ +@SuppressWarnings({"WeakerAccess"}) +public class GenericValidator implements Validator { + private List rules; + + /** + * Constructs a new instance of {@link GenericValidator}. + * + * @param rules The rules to be evaluated during validation. + */ + public GenericValidator(List rules) { + this.rules = rules; + } + + /** + * Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning). + * + * @param input The object instance to be validated. + * + * @return A {@link ValidationResult} which details the success, error, and warning validation results. + */ + @Override + public ValidationResult validate(TInput input) { + ValidationResult result = new ValidationResult(); + if (rules != null) { + rules.forEach(it -> { + boolean passes = it.evaluate(input); + if (passes) { + result.addResult(Validated.valid(it)); + } else { + result.addResult(Validated.invalid(it, it.getFailureMessage())); + } + }); + } + return result; + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Invalid.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Invalid.java new file mode 100644 index 00000000000..2f3745ebf01 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Invalid.java @@ -0,0 +1,57 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +/** + * Represents a {@link Validated} state which is "Invalid" to some degree of {@link Severity}. + */ +@SuppressWarnings({"WeakerAccess"}) +public final class Invalid extends Validated { + private String message; + private ValidationRule rule; + + /** + * Constructs a new {@link Invalid} instance. + * + * @param rule The rule which was evaluated and resulted in this state. + * @param message The message to be displayed for this invalid state. + */ + Invalid(ValidationRule rule, String message) { + this.rule = rule; + this.message = message; + } + + @Override + String getMessage() { + return message; + } + + @Override + ValidationRule getRule() { + return rule; + } + + /** + * Get details about the severity of this invalid state. + * For instance, is this an {@link Severity#ERROR} or simply a {@link Severity#WARNING}. + * + * @return The {@link Severity} enum detailing this state's severity. + */ + public Severity getSeverity() { + return rule.getSeverity(); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Severity.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Severity.java new file mode 100644 index 00000000000..7818dfd620a --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Severity.java @@ -0,0 +1,33 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +/** + * Defines different levels of severity to be used during validation. + */ +public enum Severity { + /** + * Lower severity indicating that the target state may be unpredictable, no longer supported, or known to have issues. + * Marking a type with this value should not result in application exceptions under normal operating circumstances. + */ + WARNING, + /** + * Higher severity indicating that the target state is not supported, or is known to cause problems with the application. + * Marking a type with this value should result in an application exception or error exit code under normal operating circumstances. + */ + ERROR +} \ No newline at end of file diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Valid.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Valid.java new file mode 100644 index 00000000000..d31443dca23 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Valid.java @@ -0,0 +1,53 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +/** + * Represents a {@link Validated} state which is "valid" according to the defined rule. + */ +public final class Valid extends Validated { + private ValidationRule rule; + + /** + * Defines whether or not the validation resulted in a "valid" condition. + * + * @return true if the instance passed validation of the rule returned by {@link Validated#getRule()}. + */ + @Override + boolean isValid() { + return true; + } + + /** + * Constructs a new {@link Valid} instance. + * + * @param rule The rule which was evaluated and resulted in this state. + */ + Valid(ValidationRule rule) { + this.rule = rule; + } + + @Override + public String getMessage() { + return null; + } + + @Override + public ValidationRule getRule() { + return rule; + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validated.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validated.java new file mode 100644 index 00000000000..4800cd9ce75 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validated.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +/** + * Provides details about the state of a completed validation. + */ +public abstract class Validated { + /** + * Defines whether or not the validation resulted in a "valid" condition. + * + * @return true if the instance passed validation of the rule returned by {@link Validated#getRule()}. + */ + boolean isValid() { + return false; + } + + /** + * Gets the rule which was evaluated and resulted in this state. + * + * @return The instance of {@link ValidationRule} which was evaluated. + */ + abstract ValidationRule getRule(); + + /** + * Gets the message with details about this validated state. + * + * @return A string intended to be displayed to a user. + */ + abstract String getMessage(); + + /** + * Creates an instance of an {@link Invalid} validation state. + * + * @param rule The rule which was evaluated. + * @param message The message to display to a user. + * + * @return A {@link Validated} instance representing an invalid state according to the rule. + */ + public static Validated invalid(ValidationRule rule, String message) { + return new Invalid(rule, message); + } + + /** + * Creates an instance of an {@link Valid} validation state. + * + * @param rule The rule which was evaluated. + * + * @return A {@link Validated} instance representing a valid state according to the rule. + */ + public static Validated valid(ValidationRule rule) { + return new Valid(rule); + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationResult.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationResult.java new file mode 100644 index 00000000000..166ce2b2dff --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationResult.java @@ -0,0 +1,104 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Encapsulates details about the result of a validation test. + */ +@SuppressWarnings("WeakerAccess") +public final class ValidationResult { + private final List validations; + + /** + * Constructs a new {@link ValidationResult} instance, backed by the provided validations (useful for testing). + * + * @param validations A pre-defined set of validations to begin with. + */ + private ValidationResult(List validations) { + this.validations = Collections.synchronizedList(validations); + } + + /** + * Constructs a new {@link ValidationResult} instance. + */ + public ValidationResult() { + this(new ArrayList<>()); + } + + /** + * Gets all the validated states resulting from the evaluation. This includes all {@link Valid} and {@link Invalid} instances. + * + * @return All validated results. + */ + public List getAll() { + return validations; + } + + /** + * Gets a filtered list of {@link Valid} states. + * + * @return A list containing only {@link Valid} states. + */ + public List getValid(){ + return validations.stream().filter(Validated::isValid).map(it -> (Valid)it).collect(Collectors.toList()); + } + + /** + * Gets a filters list of {@link Invalid} states with the level of {@link Severity#ERROR} + * + * @return A list of all validation errors. + */ + public List getErrors(){ + return validations.stream() + .filter(it -> !it.isValid()) + .map(it -> (Invalid)it) + .filter(it -> it.getSeverity().equals(Severity.ERROR)) + .collect(Collectors.toList()); + } + + /** + * Gets a filtered list of {@link Invalid} states with the level of {@link Severity#WARNING} + * + * @return A list of all validation warnings. + */ + public List getWarnings(){ + return validations.stream() + .filter(it -> !it.isValid()) + .map(it -> (Invalid)it) + .filter(it -> it.getSeverity().equals(Severity.WARNING)) + .collect(Collectors.toList()); + } + + /** + * Adds a validation state to the final results. + * + * @param validated The {@link Valid} or {@link Invalid} instance to add to validations. + */ + public void addResult(Validated validated) { + synchronized (validations) { + ValidationRule rule = validated.getRule(); + if (rule != null && !rule.equals(ValidationRule.empty())) { + validations.add(validated); + } + } + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationRule.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationRule.java new file mode 100644 index 00000000000..b774e8653d4 --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/ValidationRule.java @@ -0,0 +1,152 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import java.util.function.Function; + +/** + * Defines a rule to be evaluated against some target object. + */ +@SuppressWarnings("WeakerAccess") +public class ValidationRule { + private Severity severity; + private String description; + private String failureMessage; + private Function test; + + /** + * Constructs a new instance of {@link ValidationRule} + * + * @param severity The declared severity if this validation rule fails. + * @param description A description to help differentiate this rule from others (not intended to be user-facing). + * @param failureMessage The message to be displayed in the event of a test failure (intended to be user-facing). + * @param test The test condition to be applied as a part of this rule, when this function returns true, + * the evaluated instance will be considered "valid" according to this rule. + */ + ValidationRule(Severity severity, String description, String failureMessage, Function test) { + this.severity = severity; + this.description = description; + this.failureMessage = failureMessage; + this.test = test; + } + + /** + * Gets the message to be displayed in the event of a test failure (intended to be user-facing). + * + * @return A string message + */ + public String getFailureMessage() { + return failureMessage; + } + + /** + * Evalute an instance of an object against this rule. + * + * @param input The instance to be evaluated. + * + * @return true if the object state is valid according to this rule, otherwise false. + */ + public boolean evaluate(Object input) { + return test.apply(input); + } + + /** + * Get the level of severity which this rule considers a failure in evaluation. For example, if this is {@link Severity#WARNING} and + * a call to {@link ValidationRule#evaluate(Object)} returns false, a user should not expect an error to be thrown under + * normal operation. + * + * @return An enum defining how severe a failure to evaluate this rule should be considered by the caller. + */ + public Severity getSeverity() { + return severity; + } + + /** + * Gets a description to help differentiate this rule from others (not intended to be user-facing). + * + * @return A string description. + */ + public String getDescription() { + return description; + } + + /** + * Constructs an empty rule (useful for testing). + * + * @return An "empty" rule. + */ + static ValidationRule empty() { + return new ValidationRule(Severity.ERROR, "empty", "failure message", (i) -> false); + } + + /** + * Create an instance of a {@link ValidationRule} + * + * @param severity The declared severity if this validation rule fails. + * @param description A description to help differentiate this rule from others (not intended to be user-facing). + * @param failureMessage The message to be displayed in the event of a test failure (intended to be user-facing). + * @param fn The test condition to be applied as a part of this rule, when this function returns true, + * the evaluated instance will be considered "valid" according to this rule. + * @param The type of the object being evaluated. + * + * @return A new instance of a {@link ValidationRule} + */ + @SuppressWarnings("unchecked") + public static ValidationRule create(Severity severity, String description, String failureMessage, Function fn) { + return new ValidationRule(severity, description, failureMessage, (Function) fn); + } + + /** + * Create an instance of a {@link ValidationRule} which should result in an error should the evaluate of this rule fail. + * + * @param failureMessage The message to be displayed in the event of a test failure (intended to be user-facing). + * @param fn The test condition to be applied as a part of this rule, when this function returns true, + * the evaluated instance will be considered "valid" according to this rule. + * @param The type of the object being evaluated. + * + * @return A new instance of a {@link ValidationRule} + */ + @SuppressWarnings("unchecked") + public static ValidationRule error(String failureMessage, Function fn) { + return new ValidationRule(Severity.ERROR, null, failureMessage, (Function) fn); + } + + /** + * Create an instance of a {@link ValidationRule} which should result in a warning should the evaluate of this rule fail. + * + * @param description A description to help differentiate this rule from others (not intended to be user-facing). + * @param failureMessage The message to be displayed in the event of a test failure (intended to be user-facing). + * @param fn The test condition to be applied as a part of this rule, when this function returns true, + * the evaluated instance will be considered "valid" according to this rule. + * @param The type of the object being evaluated. + * + * @return A new instance of a {@link ValidationRule} + */ + @SuppressWarnings("unchecked") + public static ValidationRule warn(String description, String failureMessage, Function fn) { + return new ValidationRule(Severity.WARNING, description, failureMessage, (Function) fn); + } + + @Override + public String toString() { + return "ValidationRule{" + + "severity=" + severity + + ", description='" + description + '\'' + + ", failureMessage='" + failureMessage + '\'' + + '}'; + } +} diff --git a/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validator.java b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validator.java new file mode 100644 index 00000000000..a47e829fe6a --- /dev/null +++ b/modules/openapi-generator-core/src/main/java/org/openapitools/codegen/validation/Validator.java @@ -0,0 +1,34 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +/** + * Defines a contract allowing some input to be validated. + * + * @param The type of the input object. + */ +@FunctionalInterface +public interface Validator { + /** + * Validates input, resulting in a instance of {@link ValidationResult} which provides details on all validations performed (success, error, warning). + * + * @param input The object instance to be validated. + * + * @return A {@link ValidationResult} which details the success, error, and warning validation results. + */ + ValidationResult validate(TInput input); +} \ No newline at end of file diff --git a/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/GenericValidatorTest.java b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/GenericValidatorTest.java new file mode 100644 index 00000000000..0a258d2a139 --- /dev/null +++ b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/GenericValidatorTest.java @@ -0,0 +1,149 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +import java.util.Arrays; +import java.util.List; +import java.util.Optional; + +public class GenericValidatorTest { + class Person { + private int age; + private String name; + + Person(String name, int age) { + this.age = age; + this.name = name; + } + } + + private static boolean isValidAge(Person person) { + return person.age > 0; + } + + private static boolean isAdult(Person person) { + return person.age > 18; + } + + private static boolean isNameSet(Person person) { + return person.name != null && person.name.length() > 0; + } + + private static boolean isNameValid(Person person) { + String pattern = "^[A-Z][a-z]*$"; + return person.name.matches(pattern); + } + + private static boolean isNameNormalLength(Person person) { + return person.name.length() < 10; + } + + private List validationRules = Arrays.asList( + ValidationRule.error("Age must be positive and more than zero", GenericValidatorTest::isValidAge), + ValidationRule.error("Only adults (18 years old and older)", GenericValidatorTest::isAdult), + ValidationRule.error("Name isn't set!", GenericValidatorTest::isNameSet), + ValidationRule.error("Name isn't formatted correct", GenericValidatorTest::isNameValid), + ValidationRule.warn("Name too long?", "Name may be too long.", GenericValidatorTest::isNameNormalLength) + ); + + @Test + public void testGenericValidatorSuccesses(){ + Person person = new Person("Jim", 23); + GenericValidator validator = new GenericValidator<>(validationRules); + ValidationResult result = validator.validate(person); + List validated = result.getAll(); + List valid = result.getValid(); + List invalid = result.getErrors(); + + assertEquals(validated.size(), 5, "Expected 5 validations to run."); + assertEquals(valid.size(), 5, "Expected all validations to succeed"); + assertEquals(invalid.size(), 0, "Expected zero validations to fail."); + } + + @Test + public void testGenericValidatorSingleConditionFails(){ + Person person = new Person("Jim", 3); + GenericValidator validator = new GenericValidator<>(validationRules); + ValidationResult result = validator.validate(person); + List validated = result.getAll(); + List valid = result.getValid(); + List errors = result.getErrors(); + List warnings = result.getWarnings(); + + assertEquals(validated.size(), 5, "Expected 5 validations to run."); + assertEquals(valid.size(), 4, "Expected 4 validations to succeed"); + assertEquals(errors.size(), 1, "Expected 1 validation to fail."); + assertEquals(warnings.size(), 0, "Expected no warnings to be triggered."); + + Invalid failed = errors.get(0); + assertEquals(failed.getMessage(), "Only adults (18 years old and older)"); + } + + @Test + public void testGenericValidatorMultipleConditionsFail(){ + Person person = new Person("asdf", 3); + GenericValidator validator = new GenericValidator<>(validationRules); + ValidationResult result = validator.validate(person); + List validated = result.getAll(); + List valid = result.getValid(); + List errors = result.getErrors(); + List warnings = result.getWarnings(); + + assertEquals(validated.size(), 5, "Expected 5 validations to run."); + assertEquals(valid.size(), 3, "Expected 3 validations to succeed"); + assertEquals(errors.size(), 2, "Expected 2 validations to fail."); + assertEquals(warnings.size(), 0, "Expected no warnings to be triggered."); + + Optional nameValidation = errors.stream().filter(it -> it.getMessage().contains("formatted")).findFirst(); + Optional ageValidation = errors.stream().filter(it -> it.getMessage().contains("adults")).findFirst(); + + assertTrue(nameValidation.isPresent(), "Expected validation on name formatting to fail."); + assertTrue(ageValidation.isPresent(), "Expected validation on age requirements to fail."); + assertEquals(nameValidation.get().getMessage(), "Name isn't formatted correct"); + assertEquals(ageValidation.get().getMessage(), "Only adults (18 years old and older)"); + } + + @Test + public void testGenericValidatorErrorsAndWarnings(){ + Person person = new Person("0123456789asdfghjkl", 3); + GenericValidator validator = new GenericValidator<>(validationRules); + ValidationResult result = validator.validate(person); + List validated = result.getAll(); + List valid = result.getValid(); + List errors = result.getErrors(); + List warnings = result.getWarnings(); + + assertEquals(validated.size(), 5, "Expected 5 validations to run."); + assertEquals(valid.size(), 2, "Expected 2 validations to succeed"); + assertEquals(errors.size(), 2, "Expected 2 validations to fail."); + assertEquals(warnings.size(), 1, "Expected 1 warning to be triggered."); + + Optional nameValidation = errors.stream().filter(it -> it.getMessage().contains("formatted")).findFirst(); + Optional ageValidation = errors.stream().filter(it -> it.getMessage().contains("adults")).findFirst(); + Invalid nameLengthWarning = warnings.get(0); + + assertTrue(nameValidation.isPresent(), "Expected validation on name formatting to fail."); + assertTrue(ageValidation.isPresent(), "Expected validation on age requirements to fail."); + assertEquals(nameValidation.get().getMessage(), "Name isn't formatted correct"); + assertEquals(ageValidation.get().getMessage(), "Only adults (18 years old and older)"); + assertEquals(nameLengthWarning.getMessage(), "Name may be too long."); + } +} diff --git a/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidatedTest.java b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidatedTest.java new file mode 100644 index 00000000000..8109461de57 --- /dev/null +++ b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidatedTest.java @@ -0,0 +1,35 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +public class ValidatedTest { + @Test + public void isValidTrueForValidType(){ + boolean isValid = Validated.valid(ValidationRule.empty()).isValid(); + assertTrue(isValid); + } + + @Test + public void isValidFalseForInvalidType(){ + boolean isValid = Validated.invalid(ValidationRule.empty(), "test").isValid(); + assertFalse(isValid); + } +} diff --git a/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidationRuleTest.java b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidationRuleTest.java new file mode 100644 index 00000000000..afa6c02ff57 --- /dev/null +++ b/modules/openapi-generator-core/src/test/java/org/openapitools/codegen/validation/ValidationRuleTest.java @@ -0,0 +1,68 @@ +/* + * Copyright 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.validation; + +import org.testng.annotations.Test; + +import static org.testng.Assert.*; + +public class ValidationRuleTest { + class Sample { + private String name; + + public Sample(String name) { + this.name = name; + } + + public String getName() { + return name; + } + } + + private static boolean checkName(Sample input) { + return input.getName() != null && input.getName().length() > 7; + } + + private static boolean checkPattern(Sample input) { + String pattern = "^[A-Z][a-z]*$"; + return input.getName() != null && input.getName().matches(pattern); + } + + @Test + public void createMethodUsingMethodReference(){ + Sample nil = new Sample(null); + Sample six = new Sample("123456"); + Sample seven = new Sample("1234567"); + Sample eight = new Sample("12345678"); + ValidationRule result = ValidationRule.error("test", ValidationRuleTest::checkName); + assertFalse(result.evaluate(nil)); + assertFalse(result.evaluate(six)); + assertFalse(result.evaluate(seven)); + assertTrue(result.evaluate(eight)); + } + + @Test + public void createMethodUsingLambda(){ + Sample nil = new Sample(null); + Sample lowercase = new Sample("jim"); + Sample titlecase = new Sample("Jim"); + ValidationRule result = ValidationRule.error("test", i -> checkPattern((Sample)i)); + assertFalse(result.evaluate(nil)); + assertFalse(result.evaluate(lowercase)); + assertTrue(result.evaluate(titlecase)); + } +} diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index 47200a6754c..a6680177ec0 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -40,25 +40,34 @@ compileJava.dependsOn tasks.openApiGenerate == Plugin Setup +//# RELEASE_VERSION + +[source,group] +---- +plugins { + id "org.openapi.generator" version "4.0.3-SNAPSHOT" +} +---- + +Using https://docs.gradle.org/current/userguide/plugins.html#sec:old_plugin_application[legacy plugin application]: + [source,groovy] ---- buildscript { repositories { mavenLocal() mavenCentral() + // or, via Gradle Plugin Portal: + // url "https://plugins.gradle.org/m2/" } dependencies { - classpath "org.openapitools:openapi-generator-gradle-plugin:4.0.1" + classpath "org.openapitools:openapi-generator-gradle-plugin:4.0.3-SNAPSHOT" } } apply plugin: 'org.openapi.generator' ---- - -[NOTE] -==== -The gradle plugin is not currently published to https://plugins.gradle.org/m2/. -==== +//# /RELEASE_VERSION == Configuration @@ -591,6 +600,7 @@ Android Studio may experience a Windows-specific Guava dependency conflict with As a workaround, you may force exclude conflicting Guava dependencies. +//# RELEASE_VERSION ```gradle buildscript { repositories { @@ -599,7 +609,7 @@ buildscript { } dependencies { classpath 'com.android.tools.build:gradle:3.2.1' - classpath('org.openapitools:openapi-generator-gradle-plugin:4.0.1') { + classpath('org.openapitools:openapi-generator-gradle-plugin:4.0.3-SNAPSHOT') { exclude group: 'com.google.guava' } } @@ -612,5 +622,6 @@ configurations { // … apply plugin: 'org.openapi.generator' ``` +//# /RELEASE_VERSION See https://github.com/OpenAPITools/openapi-generator/issues/1818[OpenAPITools/openapi-generator#1818] for more details. diff --git a/modules/openapi-generator-gradle-plugin/gradle.properties b/modules/openapi-generator-gradle-plugin/gradle.properties index bf2d204d4d1..a9d1e68557c 100644 --- a/modules/openapi-generator-gradle-plugin/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/gradle.properties @@ -1,4 +1,6 @@ +# RELEASE_VERSION openApiGeneratorVersion=5.0.0-SNAPSHOT +# /RELEASE_VERSION # BEGIN placeholders # these are just placeholders to allow contributors to build directly diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 67df6888516..4145390194c 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -3,7 +3,9 @@ org.openapitools openapi-generator-project + 5.0.0-SNAPSHOT + ../.. 4.0.0 diff --git a/modules/openapi-generator-gradle-plugin/samples/.gitignore b/modules/openapi-generator-gradle-plugin/samples/.gitignore new file mode 100644 index 00000000000..0f9d8a485dc --- /dev/null +++ b/modules/openapi-generator-gradle-plugin/samples/.gitignore @@ -0,0 +1 @@ +.bak/ \ No newline at end of file diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md index ca68b2306f4..0dc7527c2a4 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md @@ -17,5 +17,5 @@ gradle generateGoWithInvalidSpec The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example: ```bash -gradle -PopenApiGeneratorVersion=4.0.1 openApiValidate +gradle -PopenApiGeneratorVersion=4.0.3-SNAPSHOT openApiValidate ``` diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties index 11f18bc06ed..c70502e281f 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties @@ -1 +1,3 @@ -openApiGeneratorVersion=4.0.1 +# RELEASE_VERSION +openApiGeneratorVersion=4.0.3-SNAPSHOT +# /RELEASE_VERSION diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.jar b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..29953ea141f Binary files /dev/null and b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.jar differ diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..e0b3fb8d70b --- /dev/null +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew new file mode 100755 index 00000000000..cccdd3d517f --- /dev/null +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat new file mode 100644 index 00000000000..e95643d6a2c --- /dev/null +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt index 28a512dd006..79e20d867ab 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/tasks/GenerateTask.kt @@ -28,7 +28,7 @@ import org.gradle.kotlin.dsl.property import org.openapitools.codegen.CodegenConstants import org.openapitools.codegen.DefaultGenerator import org.openapitools.codegen.config.CodegenConfigurator -import org.openapitools.codegen.config.GeneratorProperties +import org.openapitools.codegen.config.GlobalSettings /** @@ -40,6 +40,7 @@ import org.openapitools.codegen.config.GeneratorProperties * * @author Jim Schubert */ +@Suppress("UnstableApiUsage") open class GenerateTask : DefaultTask() { /** @@ -392,146 +393,146 @@ open class GenerateTask : DefaultTask() { } if (supportingFilesConstrainedTo.isPresent && supportingFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.SUPPORTING_FILES) + GlobalSettings.clearProperty(CodegenConstants.SUPPORTING_FILES) } if (modelFilesConstrainedTo.isPresent && modelFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.MODELS, modelFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.MODELS, modelFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.MODELS) + GlobalSettings.clearProperty(CodegenConstants.MODELS) } if (apiFilesConstrainedTo.isPresent && apiFilesConstrainedTo.get().isNotEmpty()) { - GeneratorProperties.setProperty(CodegenConstants.APIS, apiFilesConstrainedTo.get().joinToString(",")) + GlobalSettings.setProperty(CodegenConstants.APIS, apiFilesConstrainedTo.get().joinToString(",")) } else { - GeneratorProperties.clearProperty(CodegenConstants.APIS) + GlobalSettings.clearProperty(CodegenConstants.APIS) } if (generateApiDocumentation.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.get().toString()) + GlobalSettings.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.get().toString()) } if (generateModelDocumentation.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.get().toString()) + GlobalSettings.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.get().toString()) } if (generateModelTests.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.get().toString()) + GlobalSettings.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.get().toString()) } if (generateApiTests.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.API_TESTS, generateApiTests.get().toString()) + GlobalSettings.setProperty(CodegenConstants.API_TESTS, generateApiTests.get().toString()) } if (withXml.isPresent) { - GeneratorProperties.setProperty(CodegenConstants.WITH_XML, withXml.get().toString()) + GlobalSettings.setProperty(CodegenConstants.WITH_XML, withXml.get().toString()) } // now override with any specified parameters verbose.ifNotEmpty { value -> - configurator.isVerbose = value + configurator.setVerbose(value) } validateSpec.ifNotEmpty { value -> - configurator.isValidateSpec = value + configurator.setValidateSpec(value) } skipOverwrite.ifNotEmpty { value -> - configurator.isSkipOverwrite = value ?: false + configurator.setSkipOverwrite(value ?: false) } inputSpec.ifNotEmpty { value -> - configurator.inputSpec = value + configurator.setInputSpec(value) } generatorName.ifNotEmpty { value -> - configurator.generatorName = value + configurator.setGeneratorName(value) } outputDir.ifNotEmpty { value -> - configurator.outputDir = value + configurator.setOutputDir(value) } auth.ifNotEmpty { value -> - configurator.auth = value + configurator.setAuth(value) } templateDir.ifNotEmpty { value -> - configurator.templateDir = value + configurator.setTemplateDir(value) } packageName.ifNotEmpty { value -> - configurator.packageName = value + configurator.setPackageName(value) } apiPackage.ifNotEmpty { value -> - configurator.apiPackage = value + configurator.setApiPackage(value) } modelPackage.ifNotEmpty { value -> - configurator.modelPackage = value + configurator.setModelPackage(value) } modelNamePrefix.ifNotEmpty { value -> - configurator.modelNamePrefix = value + configurator.setModelNamePrefix(value) } modelNameSuffix.ifNotEmpty { value -> - configurator.modelNameSuffix = value + configurator.setModelNameSuffix(value) } invokerPackage.ifNotEmpty { value -> - configurator.invokerPackage = value + configurator.setInvokerPackage(value) } groupId.ifNotEmpty { value -> - configurator.groupId = value + configurator.setGroupId(value) } id.ifNotEmpty { value -> - configurator.artifactId = value + configurator.setArtifactId(value) } version.ifNotEmpty { value -> - configurator.artifactVersion = value + configurator.setArtifactVersion(value) } library.ifNotEmpty { value -> - configurator.library = value + configurator.setLibrary(value) } gitUserId.ifNotEmpty { value -> - configurator.gitUserId = value + configurator.setGitUserId(value) } gitRepoId.ifNotEmpty { value -> - configurator.gitRepoId = value + configurator.setGitRepoId(value) } releaseNote.ifNotEmpty { value -> - configurator.releaseNote = value + configurator.setReleaseNote(value) } httpUserAgent.ifNotEmpty { value -> - configurator.httpUserAgent = value + configurator.setHttpUserAgent(value) } ignoreFileOverride.ifNotEmpty { value -> - configurator.ignoreFileOverride = value + configurator.setIgnoreFileOverride(value) } removeOperationIdPrefix.ifNotEmpty { value -> - configurator.removeOperationIdPrefix = value!! + configurator.setRemoveOperationIdPrefix(value!!) } logToStderr.ifNotEmpty { value -> - configurator.logToStderr = value + configurator.setLogToStderr(value) } enablePostProcessFile.ifNotEmpty { value -> - configurator.enablePostProcessFile = value + configurator.setEnablePostProcessFile(value) } skipValidateSpec.ifNotEmpty { value -> @@ -602,12 +603,12 @@ open class GenerateTask : DefaultTask() { DefaultGenerator().opts(clientOptInput).generate() - out.println("Successfully generated code to ${configurator.outputDir}") + out.println("Successfully generated code to $outputDir") } catch (e: RuntimeException) { throw GradleException("Code generation failed.", e) } } finally { - GeneratorProperties.reset() + GlobalSettings.reset() } } } diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index bcf211db7d4..681b44f7f4c 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -11,7 +11,9 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 4.0.1 + + 4.0.3-SNAPSHOT + diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index 0d6d91acadd..3d362fe3ad9 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -12,7 +12,9 @@ org.openapitools openapi-generator-maven-plugin - 4.0.2-SNAPSHOT + + 4.0.3-SNAPSHOT + @@ -46,6 +48,7 @@ 1.7 1.7 + none diff --git a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml index 1b1e28ee071..186592e69de 100644 --- a/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml +++ b/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml @@ -18,7 +18,9 @@ org.openapitools openapi-generator-maven-plugin - 4.0.2-SNAPSHOT + + 4.0.3-SNAPSHOT + ${project.groupId} @@ -59,6 +61,7 @@ 1.7 1.7 + none diff --git a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml index 06f7f10c733..b1d3bfb3794 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml @@ -12,7 +12,9 @@ org.openapitools openapi-generator-maven-plugin - 4.0.2-SNAPSHOT + + 4.0.3-SNAPSHOT + diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml index 6f8fbec5c45..d733b0ee6e6 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml @@ -12,7 +12,9 @@ org.openapitools openapi-generator-maven-plugin - 4.0.2-SNAPSHOT + + 4.0.3-SNAPSHOT + diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index d1cf02880ca..c745f942276 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -4,7 +4,9 @@ org.openapitools openapi-generator-project + 5.0.0-SNAPSHOT + ../.. openapi-generator-maven-plugin diff --git a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java index 7ac66dc4da4..64bd4f92c15 100644 --- a/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java +++ b/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java @@ -54,7 +54,7 @@ import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.DefaultGenerator; import org.openapitools.codegen.config.CodegenConfigurator; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.sonatype.plexus.build.incremental.BuildContext; import org.sonatype.plexus.build.incremental.DefaultBuildContext; import org.slf4j.Logger; @@ -245,7 +245,7 @@ public class CodeGenMojo extends AbstractMojo { * To treat a document strictly against the spec. */ @Parameter(name = "strictSpec", property = "openapi.generator.maven.plugin.strictSpec", required = false) - private Boolean strictSpecBehavior; + private Boolean strictSpec; /** * To generate alias (array, map) as model @@ -471,8 +471,8 @@ public class CodeGenMojo extends AbstractMojo { configurator.setValidateSpec(!skipValidateSpec); } - if (strictSpecBehavior != null) { - configurator.setStrictSpecBehavior(strictSpecBehavior); + if (strictSpec != null) { + configurator.setStrictSpecBehavior(strictSpec); } if (logToStderr != null) { @@ -562,28 +562,28 @@ public class CodeGenMojo extends AbstractMojo { // Set generation options if (null != generateApis && generateApis) { - GeneratorProperties.setProperty(CodegenConstants.APIS, ""); + GlobalSettings.setProperty(CodegenConstants.APIS, ""); } else { - GeneratorProperties.clearProperty(CodegenConstants.APIS); + GlobalSettings.clearProperty(CodegenConstants.APIS); } if (null != generateModels && generateModels) { - GeneratorProperties.setProperty(CodegenConstants.MODELS, modelsToGenerate); + GlobalSettings.setProperty(CodegenConstants.MODELS, modelsToGenerate); } else { - GeneratorProperties.clearProperty(CodegenConstants.MODELS); + GlobalSettings.clearProperty(CodegenConstants.MODELS); } if (null != generateSupportingFiles && generateSupportingFiles) { - GeneratorProperties.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesToGenerate); + GlobalSettings.setProperty(CodegenConstants.SUPPORTING_FILES, supportingFilesToGenerate); } else { - GeneratorProperties.clearProperty(CodegenConstants.SUPPORTING_FILES); + GlobalSettings.clearProperty(CodegenConstants.SUPPORTING_FILES); } - GeneratorProperties.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.toString()); - GeneratorProperties.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.toString()); - GeneratorProperties.setProperty(CodegenConstants.API_TESTS, generateApiTests.toString()); - GeneratorProperties.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.toString()); - GeneratorProperties.setProperty(CodegenConstants.WITH_XML, withXml.toString()); + GlobalSettings.setProperty(CodegenConstants.MODEL_TESTS, generateModelTests.toString()); + GlobalSettings.setProperty(CodegenConstants.MODEL_DOCS, generateModelDocumentation.toString()); + GlobalSettings.setProperty(CodegenConstants.API_TESTS, generateApiTests.toString()); + GlobalSettings.setProperty(CodegenConstants.API_DOCS, generateApiDocumentation.toString()); + GlobalSettings.setProperty(CodegenConstants.WITH_XML, withXml.toString()); if (configOptions != null) { // Retained for backwards-compataibility with configOptions -> instantiation-types @@ -656,13 +656,13 @@ public class CodeGenMojo extends AbstractMojo { if (environmentVariables != null) { for (String key : environmentVariables.keySet()) { - originalEnvironmentVariables.put(key, GeneratorProperties.getProperty(key)); + originalEnvironmentVariables.put(key, GlobalSettings.getProperty(key)); String value = environmentVariables.get(key); if (value == null) { // don't put null values value = ""; } - GeneratorProperties.setProperty(key, value); + GlobalSettings.setProperty(key, value); configurator.addSystemProperty(key, value); } } @@ -748,9 +748,9 @@ public class CodeGenMojo extends AbstractMojo { // when running the plugin multiple consecutive times with different configurations. for (Map.Entry entry : originalEnvironmentVariables.entrySet()) { if (entry.getValue() == null) { - GeneratorProperties.clearProperty(entry.getKey()); + GlobalSettings.clearProperty(entry.getKey()); } else { - GeneratorProperties.setProperty(entry.getKey(), entry.getValue()); + GlobalSettings.setProperty(entry.getKey(), entry.getValue()); } } } diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index 2391ee2d68d..6f98abfc344 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -3,7 +3,9 @@ org.openapitools openapi-generator-project + 5.0.0-SNAPSHOT + ../.. openapi-generator-online diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java index 557d74a8197..dd609564918 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java @@ -25,7 +25,6 @@ import io.swagger.v3.parser.core.models.AuthorizationValue; import io.swagger.v3.parser.core.models.ParseOptions; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConfigLoader; import org.openapitools.codegen.DefaultGenerator; @@ -129,11 +128,10 @@ public class Generator { } ClientOptInput clientOptInput = new ClientOptInput(); - ClientOpts clientOpts = new ClientOpts(); String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + destPath; String outputFilename = outputFolder + "-bundle.zip"; - clientOptInput.opts(clientOpts).openAPI(openapi); + clientOptInput.openAPI(openapi); CodegenConfig codegenConfig; try { @@ -149,8 +147,6 @@ public class Generator { codegenConfig.setOutputDir(outputFolder); - LOGGER.debug(Json.pretty(clientOpts)); - clientOptInput.setConfig(codegenConfig); try { diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 22a5adefe13..61cfbb281ff 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -3,7 +3,9 @@ org.openapitools openapi-generator-project + 5.0.0-SNAPSHOT + ../.. 4.0.0 @@ -255,6 +257,11 @@ guava ${guava-version} + + com.fasterxml.jackson.datatype + jackson-datatype-guava + ${jackson-version} + org.testng testng @@ -313,7 +320,7 @@ org.openapitools openapi-generator-core - 5.0.0-SNAPSHOT + ${project.parent.version} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java index 2c7568589b7..8453c1c9051 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOptInput.java @@ -25,22 +25,16 @@ import java.util.List; public class ClientOptInput { private CodegenConfig config; - private ClientOpts opts; private OpenAPI openAPI; private List auths; public ClientOptInput openAPI(OpenAPI openAPI) { - this.setOpenAPI(openAPI); - return this; - } - - public ClientOptInput opts(ClientOpts opts) { - this.setOpts(opts); + this.openAPI = openAPI; return this; } public ClientOptInput config(CodegenConfig codegenConfig) { - this.setConfig(codegenConfig); + this.config = codegenConfig; return this; } @@ -65,26 +59,22 @@ public class ClientOptInput { return auths; } + @Deprecated public CodegenConfig getConfig() { return config; } + @Deprecated public void setConfig(CodegenConfig config) { this.config = config; } - public ClientOpts getOpts() { - return opts; - } - - public void setOpts(ClientOpts opts) { - this.opts = opts; - } - + @Deprecated public OpenAPI getOpenAPI() { return openAPI; } + @Deprecated public void setOpenAPI(OpenAPI openAPI) { this.openAPI = openAPI; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java deleted file mode 100644 index 00a4f291ddb..00000000000 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/ClientOpts.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) - * Copyright 2018 SmartBear Software - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.openapitools.codegen; - -import org.openapitools.codegen.auth.AuthMethod; - -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -public class ClientOpts { - protected String uri; - protected String target; - protected AuthMethod auth; - protected Map properties = new HashMap(); - protected String outputDirectory; - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getTarget() { - return target; - } - - public void setTarget(String target) { - this.target = target; - } - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - - public String getOutputDirectory() { - return outputDirectory; - } - - public void setOutputDirectory(String outputDirectory) { - this.outputDirectory = outputDirectory; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("ClientOpts: {\n"); - sb.append(" uri: ").append(uri).append(","); - sb.append(" auth: ").append(auth).append(","); - sb.append(properties); - sb.append("}"); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ClientOpts that = (ClientOpts) o; - return Objects.equals(uri, that.uri) && - Objects.equals(target, that.target) && - Objects.equals(auth, that.auth) && - Objects.equals(properties, that.properties) && - Objects.equals(outputDirectory, that.outputDirectory); - } - - @Override - public int hashCode() { - return Objects.hash(uri, target, auth, properties, outputDirectory); - } -} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index 61134701d5f..0f03cacec6e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -69,6 +69,9 @@ public class CodegenConstants { public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; public static final String WITH_GO_CODEGEN_COMMENT_DESC = "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs"; + public static final String IS_GO_SUBMODULE = "isGoSubmodule"; + public static final String IS_GO_SUBMODULE_DESC = "whether the generated Go module is a submodule"; + public static final String GROUP_ID = "groupId"; public static final String GROUP_ID_DESC = "groupId in generated pom.xml"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java index 7e545eec738..ea354971202 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenSecurity.java @@ -38,7 +38,7 @@ public class CodegenSecurity { // Oauth specific public String flow, authorizationUrl, tokenUrl; public List> scopes; - public Boolean isCode, isPassword, isApplication, isImplicit; + public Boolean isCode, isPassword, isApplication, isImplicit, hasScopes; @Override public String toString() { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 96cc4998100..c173884fa50 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -42,7 +42,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.CodegenDiscriminator.MappedModel; import org.openapitools.codegen.api.TemplatingEngineAdapter; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.examples.ExampleGenerator; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; @@ -1756,10 +1756,10 @@ public class DefaultCodegen implements CodegenConfig { m.interfaces.add(modelName); addImport(m, modelName); if (allDefinitions != null && refSchema != null) { - if (allParents.contains(modelName) && supportsMultipleInheritance) { + if (allParents.contains(ref) && supportsMultipleInheritance) { // multiple inheritance addProperties(allProperties, allRequired, refSchema); - } else if (parentName != null && parentName.equals(modelName) && supportsInheritance) { + } else if (parentName != null && parentName.equals(ref) && supportsInheritance) { // single inheritance addProperties(allProperties, allRequired, refSchema); } else { @@ -2210,6 +2210,7 @@ public class DefaultCodegen implements CodegenConfig { // property.baseType = getSimpleRef(p.get$ref()); //} // --END of revision + property.isModel = ModelUtils.isModel(p); setNonArrayMapProperty(property, type); } @@ -2932,7 +2933,7 @@ public class DefaultCodegen implements CodegenConfig { } codegenParameter.jsonSchema = Json.pretty(parameter); - if (GeneratorProperties.getProperty("debugParser") != null) { + if (GlobalSettings.getProperty("debugParser") != null) { LOGGER.info("working on Parameter " + parameter.getName()); LOGGER.info("JSON schema: " + codegenParameter.jsonSchema); } @@ -3035,6 +3036,9 @@ public class DefaultCodegen implements CodegenConfig { } else { codegenParameter.dataType = codegenProperty.dataType; } + if (ModelUtils.isObjectSchema(parameterSchema)) { + codegenProperty.complexType = codegenParameter.dataType; + } codegenParameter.dataFormat = codegenProperty.dataFormat; codegenParameter.required = codegenProperty.required; @@ -3221,6 +3225,10 @@ public class DefaultCodegen implements CodegenConfig { * @return data type */ protected String getParameterDataType(Parameter parameter, Schema schema) { + if (parameter.get$ref() != null) { + String refName = ModelUtils.getSimpleRef(parameter.get$ref()); + return toModelName(refName); + } return null; } @@ -4652,9 +4660,17 @@ public class DefaultCodegen implements CodegenConfig { schema.setAdditionalProperties(inner); } CodegenProperty codegenProperty = fromProperty("property", schema); - // only support 1-dimension map only + imports.add(codegenProperty.baseType); + CodegenProperty innerCp = codegenProperty; + while (innerCp != null) { + if (innerCp.complexType != null) { + imports.add(innerCp.complexType); + } + innerCp = innerCp.items; + } + if (StringUtils.isEmpty(bodyParameterName)) { codegenParameter.baseName = "request_body"; } else { @@ -4707,7 +4723,7 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.items = codegenProperty.items; codegenParameter.mostInnerItems = codegenProperty.mostInnerItems; codegenParameter.dataType = getTypeDeclaration(arraySchema); - codegenParameter.baseType = getSchemaType(arraySchema); + codegenParameter.baseType = getSchemaType(inner); codegenParameter.isContainer = Boolean.TRUE; codegenParameter.isListContainer = Boolean.TRUE; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java index 1226eaba9fe..8e1e40d79f3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java @@ -32,13 +32,12 @@ import io.swagger.v3.oas.models.tags.Tag; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.openapitools.codegen.api.TemplatingEngineAdapter; import org.openapitools.codegen.ignore.CodegenIgnoreProcessor; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.templating.MustacheEngineAdapter; -import org.openapitools.codegen.config.GeneratorProperties; import org.openapitools.codegen.utils.ImplementationVersion; import org.openapitools.codegen.utils.ModelUtils; import org.openapitools.codegen.utils.URLPathUtils; @@ -81,7 +80,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { this.opts = opts; this.openAPI = opts.getOpenAPI(); this.config = opts.getConfig(); - this.config.additionalProperties().putAll(opts.getOpts().getProperties()); this.templatingEngine = this.config.getTemplatingEngine(); String ignoreFileLocation = this.config.getIgnoreFilePathOverride(); @@ -145,9 +143,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { private void configureGeneratorProperties() { // allows generating only models by specifying a CSV of models to generate, or empty for all // NOTE: Boolean.TRUE is required below rather than `true` because of JVM boxing constraints and type inference. - generateApis = GeneratorProperties.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null); - generateModels = GeneratorProperties.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null); - generateSupportingFiles = GeneratorProperties.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null); + generateApis = GlobalSettings.getProperty(CodegenConstants.APIS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.APIS, null); + generateModels = GlobalSettings.getProperty(CodegenConstants.MODELS) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODELS, null); + generateSupportingFiles = GlobalSettings.getProperty(CodegenConstants.SUPPORTING_FILES) != null ? Boolean.TRUE : getGeneratorPropertyDefaultSwitch(CodegenConstants.SUPPORTING_FILES, null); if (generateApis == null && generateModels == null && generateSupportingFiles == null) { // no specifics are set, generate everything @@ -165,10 +163,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } // model/api tests and documentation options rely on parent generate options (api or model) and no other options. // They default to true in all scenarios and can only be marked false explicitly - generateModelTests = GeneratorProperties.getProperty(CodegenConstants.MODEL_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.MODEL_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_TESTS, true); - generateModelDocumentation = GeneratorProperties.getProperty(CodegenConstants.MODEL_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.MODEL_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_DOCS, true); - generateApiTests = GeneratorProperties.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true); - generateApiDocumentation = GeneratorProperties.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true); + generateModelTests = GlobalSettings.getProperty(CodegenConstants.MODEL_TESTS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.MODEL_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_TESTS, true); + generateModelDocumentation = GlobalSettings.getProperty(CodegenConstants.MODEL_DOCS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.MODEL_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.MODEL_DOCS, true); + generateApiTests = GlobalSettings.getProperty(CodegenConstants.API_TESTS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.API_TESTS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_TESTS, true); + generateApiDocumentation = GlobalSettings.getProperty(CodegenConstants.API_DOCS) != null ? Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.API_DOCS)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.API_DOCS, true); // Additional properties added for tests to exclude references in project related files config.additionalProperties().put(CodegenConstants.GENERATE_API_TESTS, generateApiTests); @@ -184,9 +182,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { config.additionalProperties().put(CodegenConstants.EXCLUDE_TESTS, true); } - if (GeneratorProperties.getProperty("debugOpenAPI") != null) { + if (GlobalSettings.getProperty("debugOpenAPI") != null) { Json.prettyPrint(openAPI); - } else if (GeneratorProperties.getProperty("debugSwagger") != null) { + } else if (GlobalSettings.getProperty("debugSwagger") != null) { // This exists for backward compatibility // We fall to this block only if debugOpenAPI is null. No need to dump this twice. LOGGER.info("Please use system property 'debugOpenAPI' instead of 'debugSwagger'."); @@ -344,7 +342,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { return; } - String modelNames = GeneratorProperties.getProperty("models"); + String modelNames = GlobalSettings.getProperty("models"); Set modelsToGenerate = null; if (modelNames != null && !modelNames.isEmpty()) { modelsToGenerate = new HashSet(Arrays.asList(modelNames.split(","))); @@ -417,8 +415,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } */ }); - Boolean skipFormModel = GeneratorProperties.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ? - Boolean.valueOf(GeneratorProperties.getProperty(CodegenConstants.SKIP_FORM_MODEL)) : + Boolean skipFormModel = GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL) != null ? + Boolean.valueOf(GlobalSettings.getProperty(CodegenConstants.SKIP_FORM_MODEL)) : getGeneratorPropertyDefaultSwitch(CodegenConstants.SKIP_FORM_MODEL, false); // process models only @@ -514,7 +512,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { throw new RuntimeException("Could not generate model '" + modelName + "'", e); } } - if (GeneratorProperties.getProperty("debugModels") != null) { + if (GlobalSettings.getProperty("debugModels") != null) { LOGGER.info("############ Model info ############"); Json.prettyPrint(allModels); } @@ -527,7 +525,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } Map> paths = processPaths(this.openAPI.getPaths()); Set apisToGenerate = null; - String apiNames = GeneratorProperties.getProperty("apis"); + String apiNames = GlobalSettings.getProperty("apis"); if (apiNames != null && !apiNames.isEmpty()) { apisToGenerate = new HashSet(Arrays.asList(apiNames.split(","))); } @@ -562,6 +560,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { operation.put("classVarName", config.toApiVarName(tag)); operation.put("importPath", config.toApiImport(tag)); operation.put("classFilename", config.toApiFilename(tag)); + operation.put("strictSpecBehavior", config.isStrictSpecBehavior()); if (allModels == null || allModels.isEmpty()) { operation.put("hasModel", false); @@ -666,7 +665,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { throw new RuntimeException("Could not generate api file for '" + tag + "'", e); } } - if (GeneratorProperties.getProperty("debugOperations") != null) { + if (GlobalSettings.getProperty("debugOperations") != null) { LOGGER.info("############ Operation info ############"); Json.prettyPrint(allOperations); } @@ -678,7 +677,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { return; } Set supportingFilesToGenerate = null; - String supportingFiles = GeneratorProperties.getProperty(CodegenConstants.SUPPORTING_FILES); + String supportingFiles = GlobalSettings.getProperty(CodegenConstants.SUPPORTING_FILES); if (supportingFiles != null && !supportingFiles.isEmpty()) { supportingFilesToGenerate = new HashSet(Arrays.asList(supportingFiles.split(","))); } @@ -867,7 +866,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { config.postProcessSupportingFileData(bundle); - if (GeneratorProperties.getProperty("debugSupportingFiles") != null) { + if (GlobalSettings.getProperty("debugSupportingFiles") != null) { LOGGER.info("############ Supporting file info ############"); Json.prettyPrint(bundle); } @@ -926,8 +925,8 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { generateSupportingFiles(files, bundle); config.processOpenAPI(openAPI); - // reset GeneratorProperties, so that the running thread can be reused for another generator-run - GeneratorProperties.reset(); + // reset GlobalSettings, so that the running thread can be reused for another generator-run + GlobalSettings.reset(); return files; } @@ -982,7 +981,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { return; } - if (GeneratorProperties.getProperty("debugOperations") != null) { + if (GlobalSettings.getProperty("debugOperations") != null) { LOGGER.info("processOperation: resourcePath= " + resourcePath + "\t;" + httpMethod + " " + operation + "\n"); } @@ -1051,6 +1050,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { if (securities != null && securities.isEmpty()) { continue; } + Map authMethods = getAuthMethods(securities, securitySchemes); if (authMethods == null || authMethods.isEmpty()) { authMethods = getAuthMethods(globalSecurities, securitySchemes); @@ -1058,6 +1058,39 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { if (authMethods != null && !authMethods.isEmpty()) { codegenOperation.authMethods = config.fromSecurity(authMethods); + List> scopes = new ArrayList>(); + if (codegenOperation.authMethods != null){ + for (CodegenSecurity security : codegenOperation.authMethods){ + if (security != null && security.isBasicBearer != null && security.isBasicBearer && + securities != null){ + for (SecurityRequirement req : securities){ + if (req == null) continue; + for (String key : req.keySet()){ + if (security.name != null && key.equals(security.name)){ + int count = 0; + for (String sc : req.get(key)){ + Map scope = new HashMap(); + scope.put("scope", sc); + scope.put("description", ""); + count++; + if (req.get(key) != null && count < req.get(key).size()){ + scope.put("hasMore", "true"); + } else { + scope.put("hasMore", null); + } + scopes.add(scope); + } + //end this inner for + break; + } + } + + } + security.hasScopes = scopes.size() > 0; + security.scopes = scopes; + } + } + } codegenOperation.hasAuthMethods = true; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index 777e4888e7a..4c251ffc4a0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -17,9 +17,8 @@ package org.openapitools.codegen.config; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.guava.GuavaModule; import io.swagger.parser.OpenAPIParser; import io.swagger.v3.core.util.Json; import io.swagger.v3.core.util.Yaml; @@ -32,100 +31,160 @@ import org.apache.commons.lang3.Validate; import org.openapitools.codegen.*; import org.openapitools.codegen.api.TemplatingEngineAdapter; import org.openapitools.codegen.auth.AuthParser; -import org.openapitools.codegen.languages.*; -import org.openapitools.codegen.templating.HandlebarsEngineAdapter; -import org.openapitools.codegen.templating.MustacheEngineAdapter; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.IOException; -import java.io.Serializable; -import java.nio.file.Paths; import java.util.*; import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; /** - * A class that contains all codegen configuration properties a user would want to manipulate. An - * instance could be created by deserializing a JSON file or being populated from CLI or Maven - * plugin parameters. It also has a convenience method for creating a ClientOptInput class which is - * THE object DefaultGenerator.java needs to generate code. + * A class which manages the contextual configuration for code generation. + * This includes configuring the generator, templating, and the workflow which orchestrates these. + * + * This helper also enables the deserialization of {@link GeneratorSettings} via application-specific Jackson JSON usage + * (see {@link DynamicSettings}. */ -public class CodegenConfigurator implements Serializable { +@SuppressWarnings("UnusedReturnValue") +public class CodegenConfigurator { public static final Logger LOGGER = LoggerFactory.getLogger(CodegenConfigurator.class); + private GeneratorSettings.Builder generatorSettingsBuilder = GeneratorSettings.newBuilder(); + private WorkflowSettings.Builder workflowSettingsBuilder = WorkflowSettings.newBuilder(); + private String generatorName; private String inputSpec; - private String outputDir; - private boolean verbose; - private boolean skipOverwrite; - private boolean removeOperationIdPrefix; - private boolean logToStderr; - private boolean validateSpec; - private boolean enablePostProcessFile; - private boolean enableMinimalUpdate; - private boolean strictSpecBehavior; - private String templateDir; private String templatingEngineName; + private Map systemProperties = new HashMap<>(); + private Map instantiationTypes = new HashMap<>(); + private Map typeMappings = new HashMap<>(); + private Map additionalProperties = new HashMap<>(); + private Map importMappings = new HashMap<>(); + private Set languageSpecificPrimitives = new HashSet<>(); + private Map reservedWordMappings = new HashMap<>(); private String auth; - private String apiPackage; - private String modelPackage; - private String invokerPackage; - private String packageName; - private String modelNamePrefix; - private String modelNameSuffix; - private String groupId; - private String artifactId; - private String artifactVersion; - private String library; - private String ignoreFileOverride; - private Map systemProperties = new HashMap(); - private Map instantiationTypes = new HashMap(); - private Map typeMappings = new HashMap(); - private Map additionalProperties = new HashMap(); - private Map importMappings = new HashMap(); - private Set languageSpecificPrimitives = new HashSet(); - private Map reservedWordMappings = new HashMap(); - - private String gitUserId = "GIT_USER_ID"; - private String gitRepoId = "GIT_REPO_ID"; - private String releaseNote = "Minor update"; - private String httpUserAgent; - - private final Map dynamicProperties = new HashMap(); - //the map that holds the JsonAnySetter/JsonAnyGetter values public CodegenConfigurator() { - this.validateSpec = true; - this.strictSpecBehavior = true; - this.setOutputDir("."); + } - /** - * Set the "language". This has drifted away from language-only to include framework and - * hyphenated generator types as well as language. - *

- * NOTE: This will eventually become language only again. It is deprecated in its current - * state. - *

- * - * @param lang The generator name. Previously, language name only. - * @return The fluent instance of {@link CodegenConfigurator} - * @deprecated Please use {@link #setGeneratorName(String)}, as generators are no longer - * identified only by language. We may reuse language in the future. - */ - @Deprecated public CodegenConfigurator setLang(String lang) { - this.setGeneratorName(lang); + public static CodegenConfigurator fromFile(String configFile) { + + if (isNotEmpty(configFile)) { + ObjectMapper mapper; + + if (FilenameUtils.isExtension(configFile, new String[]{"yml", "yaml"})) { + mapper = Yaml.mapper(); + } else { + mapper = Json.mapper(); + } + + mapper.registerModule(new GuavaModule()); + + try { + DynamicSettings settings = mapper.readValue(new File(configFile), DynamicSettings.class); + CodegenConfigurator configurator = new CodegenConfigurator(); + configurator.generatorSettingsBuilder = GeneratorSettings.newBuilder(settings.getGeneratorSettings()); + return configurator; + } catch (IOException ex) { + LOGGER.error("Unable to deserialize config file: " + configFile, ex); + } + } + return null; + } + + public CodegenConfigurator addAdditionalProperty(String key, Object value) { + this.additionalProperties.put(key, value); + generatorSettingsBuilder.withAdditionalProperty(key, value); + return this; + } + + public CodegenConfigurator addAdditionalReservedWordMapping(String key, String value) { + this.reservedWordMappings.put(key, value); + generatorSettingsBuilder.withReservedWordMapping(key, value); + return this; + } + + public CodegenConfigurator addImportMapping(String key, String value) { + this.importMappings.put(key, value); + generatorSettingsBuilder.withImportMapping(key, value); + return this; + } + + public CodegenConfigurator addInstantiationType(String key, String value) { + this.instantiationTypes.put(key, value); + generatorSettingsBuilder.withInstantiationType(key, value); + return this; + } + + public CodegenConfigurator addLanguageSpecificPrimitive(String value) { + this.languageSpecificPrimitives.add(value); + generatorSettingsBuilder.withLanguageSpecificPrimitive(value); + return this; + } + + public CodegenConfigurator addSystemProperty(String key, String value) { + this.systemProperties.put(key, value); + workflowSettingsBuilder.withSystemProperty(key, value); + return this; + } + + public CodegenConfigurator addTypeMapping(String key, String value) { + this.typeMappings.put(key, value); + generatorSettingsBuilder.withTypeMappings(this.typeMappings); + return this; + } + + public CodegenConfigurator setAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + generatorSettingsBuilder.withAdditionalProperties(additionalProperties); + return this; + } + + public CodegenConfigurator setApiPackage(String apiPackage) { + generatorSettingsBuilder.withApiPackage(apiPackage); + return this; + } + + public CodegenConfigurator setArtifactId(String artifactId) { + generatorSettingsBuilder.withArtifactId(artifactId); + return this; + } + + public CodegenConfigurator setArtifactVersion(String artifactVersion) { + generatorSettingsBuilder.withArtifactVersion(artifactVersion); + return this; + } + + public CodegenConfigurator setAuth(String auth) { + this.auth = auth; + return this; + } + + public CodegenConfigurator setEnableMinimalUpdate(boolean enableMinimalUpdate) { + workflowSettingsBuilder.withEnableMinimalUpdate(enableMinimalUpdate); + return this; + } + + public CodegenConfigurator setEnablePostProcessFile(boolean enablePostProcessFile) { + workflowSettingsBuilder.withEnablePostProcessFile(enablePostProcessFile); + return this; + } + + public CodegenConfigurator setGenerateAliasAsModel(boolean generateAliasAsModel) { + // TODO: Move to GlobalSettings? + ModelUtils.setGenerateAliasAsModel(generateAliasAsModel); return this; } /** * Sets the name of the target generator. - * + *

* The generator's name is used to uniquely identify the generator as a mechanism to lookup the * desired implementation at runtime. * @@ -134,457 +193,193 @@ public class CodegenConfigurator implements Serializable { */ public CodegenConfigurator setGeneratorName(final String generatorName) { this.generatorName = generatorName; + generatorSettingsBuilder.withGeneratorName(generatorName); + return this; + } + + public CodegenConfigurator setGitRepoId(String gitRepoId) { + generatorSettingsBuilder.withGitRepoId(gitRepoId); + return this; + } + + public CodegenConfigurator setGitUserId(String gitUserId) { + generatorSettingsBuilder.withGitUserId(gitUserId); + return this; + } + + public CodegenConfigurator setGroupId(String groupId) { + generatorSettingsBuilder.withGroupId(groupId); + return this; + } + + public CodegenConfigurator setHttpUserAgent(String httpUserAgent) { + generatorSettingsBuilder.withHttpUserAgent(httpUserAgent); + return this; + } + + public CodegenConfigurator setIgnoreFileOverride(final String ignoreFileOverride) { + workflowSettingsBuilder.withIgnoreFileOverride(ignoreFileOverride); + return this; + } + + public CodegenConfigurator setImportMappings(Map importMappings) { + generatorSettingsBuilder.withImportMappings(importMappings); return this; } public CodegenConfigurator setInputSpec(String inputSpec) { this.inputSpec = inputSpec; + workflowSettingsBuilder.withInputSpec(inputSpec); return this; } - public String getInputSpec() { - return inputSpec; - } - - public String getOutputDir() { - return outputDir; - } - - public CodegenConfigurator setOutputDir(String outputDir) { - this.outputDir = toAbsolutePathStr(outputDir); - return this; - } - - public String getModelPackage() { - return modelPackage; - } - - public CodegenConfigurator setModelPackage(String modelPackage) { - this.modelPackage = modelPackage; - return this; - } - - public String getModelNamePrefix() { - return modelNamePrefix; - } - - public CodegenConfigurator setModelNamePrefix(String prefix) { - this.modelNamePrefix = prefix; - return this; - } - - public boolean getRemoveOperationIdPrefix() { - return removeOperationIdPrefix; - } - - public CodegenConfigurator setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { - this.removeOperationIdPrefix = removeOperationIdPrefix; - return this; - } - - public boolean getEnablePostProcessFile() { - return enablePostProcessFile; - } - - public CodegenConfigurator setEnablePostProcessFile(boolean enablePostProcessFile) { - this.enablePostProcessFile = enablePostProcessFile; - return this; - } - - public boolean getLogToStderr() { - return logToStderr; - } - - public CodegenConfigurator setLogToStderr(boolean logToStderrte) { - this.logToStderr = logToStderr; - return this; - } - - public boolean getEnableMinimalUpdate() { - return enableMinimalUpdate; - } - - public CodegenConfigurator setEnableMinimalUpdate(boolean enableMinimalUpdate) { - this.enableMinimalUpdate = enableMinimalUpdate; - return this; - } - - public boolean isGenerateAliasAsModel() { - return ModelUtils.isGenerateAliasAsModel(); - } - - public CodegenConfigurator setGenerateAliasAsModel(boolean generateAliasAsModel) { - ModelUtils.setGenerateAliasAsModel(generateAliasAsModel); - return this; - } - - public String getModelNameSuffix() { - return modelNameSuffix; - } - - public CodegenConfigurator setModelNameSuffix(String suffix) { - this.modelNameSuffix = suffix; - return this; - } - - public boolean isStrictSpecBehavior() { - return strictSpecBehavior; - } - - public CodegenConfigurator setStrictSpecBehavior(boolean strictSpecBehavior) { - this.strictSpecBehavior = strictSpecBehavior; - return this; - } - - public boolean isVerbose() { - return verbose; - } - - public CodegenConfigurator setVerbose(boolean verbose) { - this.verbose = verbose; - return this; - } - - public boolean isValidateSpec() { - return validateSpec; - } - - public CodegenConfigurator setValidateSpec(final boolean validateSpec) { - this.validateSpec = validateSpec; - return this; - } - - public boolean isSkipOverwrite() { - return skipOverwrite; - } - - public CodegenConfigurator setSkipOverwrite(boolean skipOverwrite) { - this.skipOverwrite = skipOverwrite; - return this; - } - - - /** - * Gets the "language". This has drifted away from language-only to include framework and - * hyphenated generator types as well as language. - *

- * NOTE: This will eventually become language only again. It is deprecated in its current - * state. - *

- * - * @return A string which defines the generator. - * @deprecated Please use {@link #getGeneratorName()}, as generators are no longer identified - * only by language. We may reuse language in the future. - */ - @Deprecated public String getLang() { - return getGeneratorName(); - } - - public String getGeneratorName() { - return generatorName; - } - - public String getTemplateDir() { - return templateDir; - } - - public CodegenConfigurator setTemplateDir(String templateDir) { - File f = new File(templateDir); - - // check to see if the folder exists - if (!(f.exists() && f.isDirectory())) { - throw new IllegalArgumentException( - "Template directory " + templateDir + " does not exist."); - } - - this.templateDir = f.getAbsolutePath(); - return this; - } - - public String getAuth() { - return auth; - } - - public CodegenConfigurator setAuth(String auth) { - this.auth = auth; - return this; - } - - public String getApiPackage() { - return apiPackage; - } - - public CodegenConfigurator setApiPackage(String apiPackage) { - this.apiPackage = apiPackage; - return this; - } - - public String getInvokerPackage() { - return invokerPackage; - } - - public CodegenConfigurator setInvokerPackage(String invokerPackage) { - this.invokerPackage = invokerPackage; - return this; - } - - public String getPackageName() { - return packageName; - } - - public CodegenConfigurator setPackageName(String packageName) { - this.packageName = packageName; - return this; - } - - public String getGroupId() { - return groupId; - } - - public CodegenConfigurator setGroupId(String groupId) { - this.groupId = groupId; - return this; - } - - public String getArtifactId() { - return artifactId; - } - - public CodegenConfigurator setArtifactId(String artifactId) { - this.artifactId = artifactId; - return this; - } - - public String getArtifactVersion() { - return artifactVersion; - } - - public CodegenConfigurator setArtifactVersion(String artifactVersion) { - this.artifactVersion = artifactVersion; - return this; - } - - public Map getSystemProperties() { - return systemProperties; - } - - public CodegenConfigurator setSystemProperties(Map systemProperties) { - this.systemProperties = systemProperties; - return this; - } - - public CodegenConfigurator addSystemProperty(String key, String value) { - this.systemProperties.put(key, value); - return this; - } - - public Map getInstantiationTypes() { - return instantiationTypes; - } - public CodegenConfigurator setInstantiationTypes(Map instantiationTypes) { - this.instantiationTypes = instantiationTypes; + generatorSettingsBuilder.withInstantiationTypes(instantiationTypes); return this; } - public CodegenConfigurator addInstantiationType(String key, String value) { - this.instantiationTypes.put(key, value); + public CodegenConfigurator setInvokerPackage(String invokerPackage) { + generatorSettingsBuilder.withInvokerPackage(invokerPackage); return this; } - public Map getTypeMappings() { - return typeMappings; - } - - public CodegenConfigurator setTypeMappings(Map typeMappings) { - this.typeMappings = typeMappings; - return this; - } - - public CodegenConfigurator addTypeMapping(String key, String value) { - this.typeMappings.put(key, value); - return this; - } - - public Map getAdditionalProperties() { - return additionalProperties; - } - - public CodegenConfigurator setAdditionalProperties(Map additionalProperties) { - this.additionalProperties = additionalProperties; - return this; - } - - public CodegenConfigurator addAdditionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Map getImportMappings() { - return importMappings; - } - - public CodegenConfigurator setImportMappings(Map importMappings) { - this.importMappings = importMappings; - return this; - } - - public CodegenConfigurator addImportMapping(String key, String value) { - this.importMappings.put(key, value); - return this; - } - - public Set getLanguageSpecificPrimitives() { - return languageSpecificPrimitives; - } - public CodegenConfigurator setLanguageSpecificPrimitives( Set languageSpecificPrimitives) { - this.languageSpecificPrimitives = languageSpecificPrimitives; + generatorSettingsBuilder.withLanguageSpecificPrimitives(languageSpecificPrimitives); return this; } - public CodegenConfigurator addLanguageSpecificPrimitive(String value) { - this.languageSpecificPrimitives.add(value); - return this; - } - - public String getLibrary() { - return library; - } - public CodegenConfigurator setLibrary(String library) { - this.library = library; + generatorSettingsBuilder.withLibrary(library); return this; } - public String getGitUserId() { - return gitUserId; - } - - public CodegenConfigurator setGitUserId(String gitUserId) { - this.gitUserId = gitUserId; + public CodegenConfigurator setLogToStderr(boolean logToStderr) { + workflowSettingsBuilder.withLogToStderr(logToStderr); return this; } - public String getGitRepoId() { - return gitRepoId; - } - - public CodegenConfigurator setGitRepoId(String gitRepoId) { - this.gitRepoId = gitRepoId; + public CodegenConfigurator setModelNamePrefix(String prefix) { + generatorSettingsBuilder.withModelNamePrefix(prefix); return this; } - public String getReleaseNote() { - return releaseNote; + public CodegenConfigurator setModelNameSuffix(String suffix) { + generatorSettingsBuilder.withModelNameSuffix(suffix); + return this; + } + + public CodegenConfigurator setModelPackage(String modelPackage) { + generatorSettingsBuilder.withModelPackage(modelPackage); + return this; + } + + public CodegenConfigurator setOutputDir(String outputDir) { + workflowSettingsBuilder.withOutputDir(outputDir); + return this; + } + + public CodegenConfigurator setPackageName(String packageName) { + generatorSettingsBuilder.withPackageName(packageName); + return this; } public CodegenConfigurator setReleaseNote(String releaseNote) { - this.releaseNote = releaseNote; + generatorSettingsBuilder.withReleaseNote(releaseNote); return this; } - public String getHttpUserAgent() { - return httpUserAgent; - } - - public CodegenConfigurator setHttpUserAgent(String httpUserAgent) { - this.httpUserAgent = httpUserAgent; + public CodegenConfigurator setRemoveOperationIdPrefix(boolean removeOperationIdPrefix) { + workflowSettingsBuilder.withRemoveOperationIdPrefix(removeOperationIdPrefix); return this; } - public Map getReservedWordsMappings() { - return reservedWordMappings; - } - - public CodegenConfigurator setReservedWordsMappings(Map reservedWordsMappings) { - this.reservedWordMappings = reservedWordsMappings; + public CodegenConfigurator setReservedWordsMappings(Map reservedWordMappings) { + generatorSettingsBuilder.withReservedWordMappings(reservedWordMappings); return this; } - public CodegenConfigurator addAdditionalReservedWordMapping(String key, String value) { - this.reservedWordMappings.put(key, value); + public CodegenConfigurator setSkipOverwrite(boolean skipOverwrite) { + workflowSettingsBuilder.withSkipOverwrite(skipOverwrite); return this; } - public String getIgnoreFileOverride() { - return ignoreFileOverride; - } - - public CodegenConfigurator setIgnoreFileOverride(final String ignoreFileOverride) { - this.ignoreFileOverride = ignoreFileOverride; + public CodegenConfigurator setStrictSpecBehavior(boolean strictSpecBehavior) { + workflowSettingsBuilder.withStrictSpecBehavior(strictSpecBehavior); return this; } - public ClientOptInput toClientOptInput() { + public CodegenConfigurator setSystemProperties(Map systemProperties) { + workflowSettingsBuilder.withSystemProperties(systemProperties); + return this; + } + public CodegenConfigurator setTemplateDir(String templateDir) { + workflowSettingsBuilder.withTemplateDir(templateDir); + return this; + } + + public CodegenConfigurator setTemplatingEngineName(String templatingEngineName) { + this.templatingEngineName = templatingEngineName; + workflowSettingsBuilder.withTemplatingEngineName(templatingEngineName); + return this; + } + + public CodegenConfigurator setTypeMappings(Map typeMappings) { + generatorSettingsBuilder.withTypeMappings(typeMappings); + return this; + } + + public CodegenConfigurator setValidateSpec(final boolean validateSpec) { + workflowSettingsBuilder.withValidateSpec(validateSpec); + return this; + } + + public CodegenConfigurator setVerbose(boolean verbose) { + workflowSettingsBuilder.withVerbose(verbose); + return this; + } + + @SuppressWarnings("WeakerAccess") + public Context toContext() { Validate.notEmpty(generatorName, "language/generatorName must be specified"); Validate.notEmpty(inputSpec, "input spec must be specified"); - setVerboseFlags(); - setSystemProperties(); - - CodegenConfig config = CodegenConfigLoader.forName(generatorName); - - config.setInputSpec(inputSpec); - config.setOutputDir(outputDir); - config.setSkipOverwrite(skipOverwrite); - config.setIgnoreFilePathOverride(ignoreFileOverride); - config.setRemoveOperationIdPrefix(removeOperationIdPrefix); - config.setEnablePostProcessFile(enablePostProcessFile); - config.setEnableMinimalUpdate(enableMinimalUpdate); - - config.instantiationTypes().putAll(instantiationTypes); - config.typeMapping().putAll(typeMappings); - config.importMapping().putAll(importMappings); - config.languageSpecificPrimitives().addAll(languageSpecificPrimitives); - config.reservedWordsMappings().putAll(reservedWordMappings); - - config.setStrictSpecBehavior(isStrictSpecBehavior()); - - checkAndSetAdditionalProperty(apiPackage, CodegenConstants.API_PACKAGE); - checkAndSetAdditionalProperty(modelPackage, CodegenConstants.MODEL_PACKAGE); - checkAndSetAdditionalProperty(invokerPackage, CodegenConstants.INVOKER_PACKAGE); - checkAndSetAdditionalProperty(packageName, CodegenConstants.PACKAGE_NAME); - checkAndSetAdditionalProperty(groupId, CodegenConstants.GROUP_ID); - checkAndSetAdditionalProperty(artifactId, CodegenConstants.ARTIFACT_ID); - checkAndSetAdditionalProperty(artifactVersion, CodegenConstants.ARTIFACT_VERSION); - checkAndSetAdditionalProperty(templateDir, toAbsolutePathStr(templateDir), - CodegenConstants.TEMPLATE_DIR); - checkAndSetAdditionalProperty(templatingEngineName, CodegenConstants.TEMPLATING_ENGINE); - checkAndSetAdditionalProperty(modelNamePrefix, CodegenConstants.MODEL_NAME_PREFIX); - checkAndSetAdditionalProperty(modelNameSuffix, CodegenConstants.MODEL_NAME_SUFFIX); - checkAndSetAdditionalProperty(gitUserId, CodegenConstants.GIT_USER_ID); - checkAndSetAdditionalProperty(gitRepoId, CodegenConstants.GIT_REPO_ID); - checkAndSetAdditionalProperty(releaseNote, CodegenConstants.RELEASE_NOTE); - checkAndSetAdditionalProperty(httpUserAgent, CodegenConstants.HTTP_USER_AGENT); - - handleDynamicProperties(config); - - if (isNotEmpty(library)) { - config.setLibrary(library); - } - - String templatingEngineId; if (isEmpty(templatingEngineName)) { // Built-in templates are mustache, but allow users to use a simplified handlebars engine for their custom templates. - templatingEngineId = "mustache"; + workflowSettingsBuilder.withTemplatingEngineName("mustache"); + } else { + workflowSettingsBuilder.withTemplatingEngineName(templatingEngineName); } - else { templatingEngineId = templatingEngineName; } - TemplatingEngineAdapter templatingEngine = TemplatingEngineLoader.byIdentifier(templatingEngineId); - config.setTemplatingEngine(templatingEngine); + // at this point, all "additionalProperties" are set, and are now immutable per GeneratorSettings instance. + GeneratorSettings generatorSettings = generatorSettingsBuilder.build(); + WorkflowSettings workflowSettings = workflowSettingsBuilder.build(); - config.additionalProperties().putAll(additionalProperties); + if (workflowSettings.isVerbose()) { + LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" + + "\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" + + "\n - [debugModels] prints models passed to the template engine" + + "\n - [debugOperations] prints operations passed to the template engine" + + "\n - [debugSupportingFiles] prints additional data passed to the template engine"); - ClientOptInput input = new ClientOptInput().config(config); + GlobalSettings.setProperty("debugOpenAPI", ""); + GlobalSettings.setProperty("debugModels", ""); + GlobalSettings.setProperty("debugOperations", ""); + GlobalSettings.setProperty("debugSupportingFiles", ""); + } - final List authorizationValues = AuthParser.parse(auth); + for (Map.Entry entry : workflowSettings.getSystemProperties().entrySet()) { + GlobalSettings.setProperty(entry.getKey(), entry.getValue()); + } + + // TODO: Support custom spec loader implementations (https://github.com/OpenAPITools/openapi-generator/issues/844) + final List authorizationValues = AuthParser.parse(this.auth); ParseOptions options = new ParseOptions(); options.setResolve(true); SwaggerParseResult result = new OpenAPIParser().readLocation(inputSpec, authorizationValues, options); + // TODO: Move custom validations to a separate type as part of a "Workflow" Set validationMessages = new HashSet<>(result.getMessages()); OpenAPI specification = result.getOpenAPI(); @@ -598,12 +393,10 @@ public class CodegenConfigurator implements Serializable { } } - if (this.isValidateSpec()) { - StringBuilder sb = new StringBuilder(); - sb.append( - "There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI)."); - sb.append(System.lineSeparator()); - SpecValidationException ex = new SpecValidationException(sb.toString()); + if (workflowSettings.isValidateSpec()) { + String sb = "There were issues with the specification. The option can be disabled via validateSpec (Maven/Gradle) or --skip-validate-spec (CLI)." + + System.lineSeparator(); + SpecValidationException ex = new SpecValidationException(sb); ex.setErrors(validationMessages); ex.setWarnings(warnings); throw ex; @@ -626,95 +419,44 @@ public class CodegenConfigurator implements Serializable { } } - input.opts(new ClientOpts()).openAPI(specification); - - return input; + return new Context<>(specification, generatorSettings, workflowSettings); } - @JsonAnySetter public CodegenConfigurator addDynamicProperty(String name, Object value) { - dynamicProperties.put(name, value); - return this; - } + public ClientOptInput toClientOptInput() { + CodegenConfig config = CodegenConfigLoader.forName(generatorName); - @JsonAnyGetter public Map getDynamicProperties() { - return dynamicProperties; - } + Context context = toContext(); + WorkflowSettings workflowSettings = context.getWorkflowSettings(); + GeneratorSettings generatorSettings = context.getGeneratorSettings(); - private void handleDynamicProperties(CodegenConfig codegenConfig) { - for (CliOption langCliOption : codegenConfig.cliOptions()) { - String opt = langCliOption.getOpt(); - if (dynamicProperties.containsKey(opt)) { - codegenConfig.additionalProperties().put(opt, dynamicProperties.get(opt)); - } else if (systemProperties.containsKey(opt)) { - codegenConfig.additionalProperties().put(opt, systemProperties.get(opt)); - } - } - } - - private void setVerboseFlags() { - if (!verbose) { - return; - } - LOGGER.info("\nVERBOSE MODE: ON. Additional debug options are injected" - + "\n - [debugOpenAPI] prints the OpenAPI specification as interpreted by the codegen" - + "\n - [debugModels] prints models passed to the template engine" - + "\n - [debugOperations] prints operations passed to the template engine" - + "\n - [debugSupportingFiles] prints additional data passed to the template engine"); - - GeneratorProperties.setProperty("debugOpenAPI", ""); - GeneratorProperties.setProperty("debugModels", ""); - GeneratorProperties.setProperty("debugOperations", ""); - GeneratorProperties.setProperty("debugSupportingFiles", ""); - } - - private void setSystemProperties() { - for (Map.Entry entry : systemProperties.entrySet()) { - GeneratorProperties.setProperty(entry.getKey(), entry.getValue()); - } - } - - private static String toAbsolutePathStr(String path) { - if (isNotEmpty(path)) { - return Paths.get(path).toAbsolutePath().toString(); + if (isNotEmpty(generatorSettings.getLibrary())) { + config.setLibrary(generatorSettings.getLibrary()); } - return path; + // TODO: Work toward CodegenConfig having a "WorkflowSettings" property, or better a "Workflow" object which itself has a "WorkflowSettings" property. + config.setInputSpec(workflowSettings.getInputSpec()); + config.setOutputDir(workflowSettings.getOutputDir()); + config.setSkipOverwrite(workflowSettings.isSkipOverwrite()); + config.setIgnoreFilePathOverride(workflowSettings.getIgnoreFileOverride()); + config.setRemoveOperationIdPrefix(workflowSettings.isRemoveOperationIdPrefix()); + config.setEnablePostProcessFile(workflowSettings.isEnablePostProcessFile()); + config.setEnableMinimalUpdate(workflowSettings.isEnableMinimalUpdate()); + config.setStrictSpecBehavior(workflowSettings.isStrictSpecBehavior()); - } + TemplatingEngineAdapter templatingEngine = TemplatingEngineLoader.byIdentifier(workflowSettings.getTemplatingEngineName()); + config.setTemplatingEngine(templatingEngine); - private void checkAndSetAdditionalProperty(String property, String propertyKey) { - checkAndSetAdditionalProperty(property, property, propertyKey); - } + // TODO: Work toward CodegenConfig having a "GeneratorSettings" property. + config.instantiationTypes().putAll(generatorSettings.getInstantiationTypes()); + config.typeMapping().putAll(generatorSettings.getTypeMappings()); + config.importMapping().putAll(generatorSettings.getImportMappings()); + config.languageSpecificPrimitives().addAll(generatorSettings.getLanguageSpecificPrimitives()); + config.reservedWordsMappings().putAll(generatorSettings.getReservedWordMappings()); + config.additionalProperties().putAll(generatorSettings.getAdditionalProperties()); - private void checkAndSetAdditionalProperty(String property, String valueToSet, - String propertyKey) { - if (isNotEmpty(property)) { - additionalProperties.put(propertyKey, valueToSet); - } - } + ClientOptInput input = new ClientOptInput() + .config(config); - public static CodegenConfigurator fromFile(String configFile) { - - if (isNotEmpty(configFile)) { - ObjectMapper mapper; - - if (FilenameUtils.isExtension(configFile, new String[] {"yml", "yaml"})) { - mapper = Yaml.mapper(); - } else { - mapper = Json.mapper(); - } - - try { - return mapper.readValue(new File(configFile), CodegenConfigurator.class); - } catch (IOException ex) { - LOGGER.error("Unable to deserialize config file: " + configFile, ex); - } - } - return null; - } - - public CodegenConfigurator setTemplatingEngineName(String templatingEngineName) { - this.templatingEngineName = templatingEngineName; - return this; + return input.openAPI((OpenAPI)context.getSpecDocument()); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java new file mode 100644 index 00000000000..60164226f29 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/DynamicSettings.java @@ -0,0 +1,77 @@ +package org.openapitools.codegen.config; + +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonUnwrapped; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + +import java.lang.reflect.Field; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +/** + * Represents a serialization helper of {@link GeneratorSettings} and {@link WorkflowSettings}. When used to deserialize any available Jackson binding input, + * this will accumulate any "unknown properties" into {@link GeneratorSettings#getAdditionalProperties()} as a side effect of calling + * {@link DynamicSettings#getGeneratorSettings()}. + */ +@SuppressWarnings({"unused", "WeakerAccess"}) +public class DynamicSettings { + @JsonAnySetter + private Map dynamicProperties = new HashMap<>(); + + @JsonUnwrapped + @JsonDeserialize(builder = GeneratorSettings.Builder.class) + private GeneratorSettings generatorSettings; + + @JsonUnwrapped + @JsonDeserialize(builder = WorkflowSettings.Builder.class) + private WorkflowSettings workflowSettings; + + /** + * Gets the {@link GeneratorSettings} included in the config object. + * + * @return A new instance of settings + */ + public GeneratorSettings getGeneratorSettings() { + excludeSettingsFromDynamicProperties(); + return GeneratorSettings.newBuilder(generatorSettings) + .withAdditionalProperties(dynamicProperties) + .build(); + } + + /** + * Gets the {@link WorkflowSettings} included in the config object. + * + * @return A new instance of settings + */ + public WorkflowSettings getWorkflowSettings() { + excludeSettingsFromDynamicProperties(); + return WorkflowSettings.newBuilder(workflowSettings) + .build(); + } + + @JsonCreator + public DynamicSettings() { } + + /** + * Gets all "custom" properties included in the config object. + * + * @return All user-specified custom properties. + */ + public Map getDynamicProperties() { + return dynamicProperties; + } + + private void excludeSettingsFromDynamicProperties(){ + Set fieldNames = new HashSet<>(); + for (Field field : GeneratorSettings.class.getDeclaredFields()) { + fieldNames.add(field.getName()); + } + for (Field field : WorkflowSettings.class.getDeclaredFields()) { + fieldNames.add(field.getName()); + } + dynamicProperties.keySet().removeAll(fieldNames); + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java similarity index 85% rename from modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java rename to modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java index 97fcb07f2a5..0f078821024 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GeneratorProperties.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/GlobalSettings.java @@ -19,14 +19,17 @@ package org.openapitools.codegen.config; import java.util.Properties; /** - * GeneratorProperties encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable, + * GlobalSettings encapsulates SystemProperties, since the codegen mechanism heavily relies on a stable, * non-changing System Property Basis. Using plain System.(get|set|clear)Property raises Race-Conditions in combination * with Code, that uses System.setProperties (e.g. maven-surefire-plugin). + * + * This provides a set of properties specific to the executing thread, such that the generator may not modify system properties + * consumed by other threads. * * @author gndrm * @since 2018 */ -public class GeneratorProperties { +public class GlobalSettings { private static ThreadLocal properties = new InheritableThreadLocal() { @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java index 56ea40ef9ab..4392dcff5df 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractGoCodegen.java @@ -361,10 +361,11 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege iterator.remove(); } - // this will only import "fmt" if there are items in pathParams + // this will only import "fmt" and "strings" if there are items in pathParams for (CodegenOperation operation : operations) { if (operation.pathParams != null && operation.pathParams.size() > 0) { imports.add(createMapping("import", "fmt")); + imports.add(createMapping("import", "strings")); break; //just need to import once } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java index 0ef33cf0480..882fccb4a21 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java @@ -175,7 +175,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code dateLibrary.setEnum(dateOptions); cliOptions.add(dateLibrary); - CliOption java8Mode = new CliOption(JAVA8_MODE, "Option. Use Java8 classes instead of third party equivalents").defaultValue(String.valueOf(this.java8Mode)); + CliOption java8Mode = CliOption.newBoolean(JAVA8_MODE, "Option. Use Java8 classes instead of third party equivalents", this.java8Mode); Map java8ModeOptions = new HashMap<>(); java8ModeOptions.put("true", "Use Java 8 classes such as Base64"); java8ModeOptions.put("false", "Various third party libraries as needed"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java index a2eaa806b21..ae3ed7e12da 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java @@ -38,6 +38,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { public static final String USE_SWASHBUCKLE = "useSwashbuckle"; public static final String ASPNET_CORE_VERSION = "aspnetCoreVersion"; + public static final String SWASHBUCKLE_VERSION = "swashbuckleVersion"; public static final String CLASS_MODIFIER = "classModifier"; public static final String OPERATION_MODIFIER = "operationModifier"; public static final String OPERATION_IS_ASYNC = "operationIsAsync"; @@ -51,6 +52,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { public static final String SDK_LIB = "Microsoft.NET.Sdk"; public static final String COMPATIBILITY_VERSION = "compatibilityVersion"; public static final String IS_LIBRARY = "isLibrary"; + public static final String USE_FRAMEWORK_REFERENCE = "useFrameworkReference"; + public static final String USE_NEWTONSOFT = "useNewtonsoft"; + public static final String USE_DEFAULT_ROUTING = "useDefaultRouting"; + public static final String NEWTONSOFT_VERSION = "newtonsoftVersion"; private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; @@ -60,18 +65,23 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { private boolean useSwashbuckle = true; protected int serverPort = 8080; protected String serverHost = "0.0.0.0"; - protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 2.2 (default), 2.1, 2.0 (deprecated)"); + protected CliOption swashbuckleVersion = new CliOption(SWASHBUCKLE_VERSION, "Swashbucke version: 3.0.0, 4.0.0"); ; // default to 2.1 + protected CliOption aspnetCoreVersion = new CliOption(ASPNET_CORE_VERSION, "ASP.NET Core version: 3.0 (preview4 only), 2.2, 2.1, 2.0 (deprecated)"); private CliOption classModifier = new CliOption(CLASS_MODIFIER, "Class Modifier can be empty, abstract"); private CliOption operationModifier = new CliOption(OPERATION_MODIFIER, "Operation Modifier can be virtual, abstract or partial"); private CliOption modelClassModifier = new CliOption(MODEL_CLASS_MODIFIER, "Model Class Modifier can be nothing or partial"); private boolean generateBody = true; private CliOption buildTarget = new CliOption("buildTarget", "Target to build an application or library"); private String projectSdk = SDK_WEB; - private String compatibilityVersion = "Version_2_1"; + private String compatibilityVersion = "Version_2_2"; private boolean operationIsAsync = false; private boolean operationResultTask = false; private boolean isLibrary = false; + private boolean useFrameworkReference = false; + private boolean useNewtonsoft = true; + private boolean useDefaultRouting = true; + private String newtonsoftVersion = "3.0.0-preview5-19227-01"; public AspNetCoreServerCodegen() { super(); @@ -146,10 +156,18 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { aspnetCoreVersion.addEnum("2.0", "ASP.NET COre 2.0"); aspnetCoreVersion.addEnum("2.1", "ASP.NET Core 2.1"); aspnetCoreVersion.addEnum("2.2", "ASP.NET Core 2.2"); + aspnetCoreVersion.addEnum("3.0", "ASP.NET Core 3.0"); aspnetCoreVersion.setDefault("2.2"); aspnetCoreVersion.setOptValue(aspnetCoreVersion.getDefault()); addOption(aspnetCoreVersion.getOpt(), aspnetCoreVersion.getDescription(), aspnetCoreVersion.getOptValue()); + swashbuckleVersion.addEnum("3.0.0", "Swashbuckle 3.0.0"); + swashbuckleVersion.addEnum("4.0.0", "Swashbuckle 4.0.0"); + swashbuckleVersion.addEnum("5.0.0", "Swashbuckle 5.0.0"); + swashbuckleVersion.setDefault("3.0.0"); + swashbuckleVersion.setOptValue(swashbuckleVersion.getDefault()); + addOption(swashbuckleVersion.getOpt(), swashbuckleVersion.getDescription(), swashbuckleVersion.getOptValue()); + // CLI Switches addSwitch(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC, @@ -175,6 +193,23 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { "Is the build a library", isLibrary); + addSwitch(USE_FRAMEWORK_REFERENCE, + "Use frameworkReference for ASP.NET Core 3.0+ and PackageReference ASP.NET Core 2.2 or earlier.", + useFrameworkReference); + + addSwitch(USE_NEWTONSOFT, + "Uses the Newtonsoft JSON library.", + useNewtonsoft); + + addOption(NEWTONSOFT_VERSION, + "Version for Microsoft.AspNetCore.Mvc.NewtonsoftJson for ASP.NET Core 3.0+", + newtonsoftVersion); + + + addSwitch(USE_DEFAULT_ROUTING, + "Use default routing for the ASP.NET Core version. For 3.0 turn off default because it is not yet supported.", + useDefaultRouting); + classModifier.addEnum("", "Keep class default with no modifier"); classModifier.addEnum("abstract", "Make class abstract"); classModifier.setDefault(""); @@ -246,6 +281,11 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { } additionalProperties.put("packageGuid", packageGuid); + if (!additionalProperties.containsKey(NEWTONSOFT_VERSION)) { + additionalProperties.put(NEWTONSOFT_VERSION, newtonsoftVersion); + } else { + newtonsoftVersion = (String)additionalProperties.get(NEWTONSOFT_VERSION); + } // CHeck for the modifiers etc. // The order of the checks is important. @@ -275,6 +315,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { // determine the ASP.NET core version setting setAspnetCoreVersion(packageFolder); + setSwashbuckleVersion(); + setIsFramework(); + setUseNewtonsoft(); + setUseEndpointRouting(); supportingFiles.add(new SupportingFile("build.sh.mustache", "", "build.sh")); supportingFiles.add(new SupportingFile("build.bat.mustache", "", "build.bat")); @@ -309,6 +353,8 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("Filters" + File.separator + "GeneratePathParamsValidationFilter.mustache", packageFolder + File.separator + "Filters", "GeneratePathParamsValidationFilter.cs")); } + + supportingFiles.add(new SupportingFile("Authentication" + File.separator + "ApiAuthentication.mustache",packageFolder + File.separator + "Authentication", "ApiAuthentication.cs")); } public void setPackageGuid(String packageGuid) { @@ -477,10 +523,66 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { if (isLibrary) { operationIsAsync = false; additionalProperties.put(OPERATION_IS_ASYNC, operationIsAsync); - } else if (additionalProperties.containsKey(OPERATION_IS_ASYNC)) { + } else if (additionalProperties.containsKey(OPERATION_IS_ASYNC)) { operationIsAsync = convertPropertyToBooleanAndWriteBack(OPERATION_IS_ASYNC); } else { additionalProperties.put(OPERATION_IS_ASYNC, operationIsAsync); } } + + private void setIsFramework() { + if (aspnetCoreVersion.getOptValue().startsWith("3.")) {// default, do nothing + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing to use frameworkReference instead of packageReference "); + useFrameworkReference = true; + additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference); + } else { + if (additionalProperties.containsKey(USE_FRAMEWORK_REFERENCE)) { + useFrameworkReference = convertPropertyToBooleanAndWriteBack(USE_FRAMEWORK_REFERENCE); + } else { + additionalProperties.put(USE_FRAMEWORK_REFERENCE, useFrameworkReference); + } + } + + } + + private void setUseNewtonsoft() { + if (aspnetCoreVersion.getOptValue().startsWith("2.")) { + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so staying on default json library."); + useNewtonsoft = false; + additionalProperties.put(USE_NEWTONSOFT, useNewtonsoft); + } else { + if (additionalProperties.containsKey(USE_NEWTONSOFT)) { + useNewtonsoft = convertPropertyToBooleanAndWriteBack(USE_NEWTONSOFT); + } else { + additionalProperties.put(USE_NEWTONSOFT, useNewtonsoft); + } + } + } + + private void setUseEndpointRouting() { + if (aspnetCoreVersion.getOptValue().startsWith("3.")) { + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so switching to old style endpoint routing."); + useDefaultRouting = false; + additionalProperties.put(USE_DEFAULT_ROUTING, useDefaultRouting); + } else { + if (additionalProperties.containsKey(USE_DEFAULT_ROUTING)) { + useDefaultRouting = convertPropertyToBooleanAndWriteBack(USE_DEFAULT_ROUTING); + } else { + additionalProperties.put(USE_DEFAULT_ROUTING, useDefaultRouting); + } + } + } + + private void setSwashbuckleVersion() { + setCliOption(swashbuckleVersion); + + if (aspnetCoreVersion.getOptValue().startsWith("3.")) { + LOGGER.warn("ASP.NET core version is " + aspnetCoreVersion.getOptValue() + " so changing default Swashbuckle version to 4.0.0."); + swashbuckleVersion.setOptValue("4.0.0"); + additionalProperties.put(SWASHBUCKLE_VERSION, swashbuckleVersion.getOptValue()); + } else { + // default, do nothing + LOGGER.info("Swashbuckle version: " + swashbuckleVersion.getOptValue()); + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index af79157f93a..749ae845c8e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -33,6 +33,7 @@ public class GoClientCodegen extends AbstractGoCodegen { protected String packageVersion = "1.0.0"; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; + protected boolean isGoSubmodule = false; public static final String WITH_GO_CODEGEN_COMMENT = "withGoCodegenComment"; public static final String WITH_XML = "withXml"; @@ -51,6 +52,7 @@ public class GoClientCodegen extends AbstractGoCodegen { // default HIDE_GENERATION_TIMESTAMP to true hideGenerationTimestamp = Boolean.TRUE; + cliOptions.add(CliOption.newBoolean(CodegenConstants.IS_GO_SUBMODULE, CodegenConstants.IS_GO_SUBMODULE_DESC)); cliOptions.add(CliOption.newBoolean(WITH_GO_CODEGEN_COMMENT, "whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs")); cliOptions.add(CliOption.newBoolean(WITH_XML, "whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML)")); @@ -111,6 +113,13 @@ public class GoClientCodegen extends AbstractGoCodegen { additionalProperties.put(WITH_XML, "true"); } } + + if (additionalProperties.containsKey(CodegenConstants.IS_GO_SUBMODULE)) { + setIsGoSubmodule(Boolean.parseBoolean(additionalProperties.get(CodegenConstants.IS_GO_SUBMODULE).toString())); + if (isGoSubmodule) { + additionalProperties.put(CodegenConstants.IS_GO_SUBMODULE, "true"); + } + } } /** @@ -184,4 +193,8 @@ public class GoClientCodegen extends AbstractGoCodegen { this.packageVersion = packageVersion; } + public void setIsGoSubmodule(boolean isGoSubmodule) { + this.isGoSubmodule = isGoSubmodule; + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java index 35c8a83aaa2..b95c9bf8d3b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaClientCodegen.java @@ -54,6 +54,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String PARCELABLE_MODEL = "parcelableModel"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String USE_REFLECTION_EQUALS_HASHCODE = "useReflectionEqualsHashCode"; + public static final String CASE_INSENSITIVE_RESPONSE_HEADERS = "caseInsensitiveResponseHeaders"; public static final String PLAY_24 = "play24"; public static final String PLAY_25 = "play25"; @@ -90,6 +91,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean useGzipFeature = false; protected boolean useRuntimeException = false; protected boolean useReflectionEqualsHashCode = false; + protected boolean caseInsensitiveResponseHeaders = false; protected String authFolder; public JavaClientCodegen() { @@ -122,6 +124,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception")); cliOptions.add(CliOption.newBoolean(FEIGN_VERSION, "Version of OpenFeign: '10.x', '9.x' (default)")); cliOptions.add(CliOption.newBoolean(USE_REFLECTION_EQUALS_HASHCODE, "Use org.apache.commons.lang3.builder for equals and hashCode in the models. WARNING: This will fail under a security manager, unless the appropriate permissions are set up correctly and also there's potential performance impact.")); + cliOptions.add(CliOption.newBoolean(CASE_INSENSITIVE_RESPONSE_HEADERS, "Make API response's headers case-insensitive. Available on " + OKHTTP_GSON + ", " + JERSEY2 + " libraries")); + supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.x. JSON processing: Jackson 2.8.x. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. IMPORTANT NOTE: jersey 1.x is no longer actively maintained so please upgrade to 'jersey2' or other HTTP libaries instead."); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.x"); @@ -232,6 +236,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.setUseReflectionEqualsHashCode(convertPropertyToBooleanAndWriteBack(USE_REFLECTION_EQUALS_HASHCODE)); } + if (additionalProperties.containsKey(CASE_INSENSITIVE_RESPONSE_HEADERS)) { + this.setUseReflectionEqualsHashCode(convertPropertyToBooleanAndWriteBack(CASE_INSENSITIVE_RESPONSE_HEADERS)); + } + final String invokerFolder = (sourceFolder + '/' + invokerPackage).replace(".", "/"); final String apiFolder = (sourceFolder + '/' + apiPackage).replace(".", "/"); authFolder = (sourceFolder + '/' + invokerPackage + ".auth").replace(".", "/"); @@ -659,6 +667,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.useReflectionEqualsHashCode = useReflectionEqualsHashCode; } + public void setCaseInsensitiveResponseHeaders(final Boolean caseInsensitiveResponseHeaders) { + this.caseInsensitiveResponseHeaders = caseInsensitiveResponseHeaders; + } + final private static Pattern JSON_MIME_PATTERN = Pattern.compile("(?i)application\\/json(;.*)?"); final private static Pattern JSON_VENDOR_MIME_PATTERN = Pattern.compile("(?i)application\\/vnd.(.*)+json(;.*)?"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 7ceeece3fa9..d44daedd70b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -21,7 +21,7 @@ import io.swagger.v3.oas.models.Operation; import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,8 +46,8 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen { invokerPackage = "org.openapitools.controllers"; artifactId = "openapi-inflector-server"; dateLibrary = "legacy"; //TODO: add joda support - apiPackage = GeneratorProperties.getProperty("swagger.codegen.inflector.apipackage", "org.openapitools.controllers"); - modelPackage = GeneratorProperties.getProperty("swagger.codegen.inflector.modelpackage", "org.openapitools.model"); + apiPackage = GlobalSettings.getProperty("swagger.codegen.inflector.apipackage", "org.openapitools.controllers"); + modelPackage = GlobalSettings.getProperty("swagger.codegen.inflector.modelpackage", "org.openapitools.model"); // clear model and api doc template as this codegen // does not support auto-generated markdown doc at the moment diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java index ef6b005fb0b..47df13f7295 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java @@ -19,7 +19,7 @@ package org.openapitools.codegen.languages; import org.apache.commons.lang3.BooleanUtils; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,17 +58,17 @@ public class JavaUndertowServerCodegen extends AbstractJavaCodegen { modelDocTemplateFiles.remove("model_doc.mustache"); apiDocTemplateFiles.remove("api_doc.mustache"); - if(GeneratorProperties.getProperty("swagger.codegen.undertow.apipackage") != null && GeneratorProperties.getProperty("openapi.codegen.undertow.apipackage") == null) { + if(GlobalSettings.getProperty("swagger.codegen.undertow.apipackage") != null && GlobalSettings.getProperty("openapi.codegen.undertow.apipackage") == null) { LOGGER.warn("System property 'swagger.codegen.undertow.apipackage' was renamed to 'swagger.codegen.undertow.apipackage'"); - apiPackage = GeneratorProperties.getProperty("swagger.codegen.undertow.apipackage", "org.openapitools.handler"); + apiPackage = GlobalSettings.getProperty("swagger.codegen.undertow.apipackage", "org.openapitools.handler"); } else { - apiPackage = GeneratorProperties.getProperty("openapi.codegen.undertow.apipackage", "org.openapitools.handler"); + apiPackage = GlobalSettings.getProperty("openapi.codegen.undertow.apipackage", "org.openapitools.handler"); } - if(GeneratorProperties.getProperty("swagger.codegen.undertow.modelpackage") != null && GeneratorProperties.getProperty("openapi.codegen.undertow.modelpackage") == null) { + if(GlobalSettings.getProperty("swagger.codegen.undertow.modelpackage") != null && GlobalSettings.getProperty("openapi.codegen.undertow.modelpackage") == null) { LOGGER.warn("System property 'swagger.codegen.undertow.modelpackage' was renamed to 'openapi.codegen.undertow.modelpackage'"); - modelPackage = GeneratorProperties.getProperty("swagger.codegen.undertow.modelpackage", "org.openapitools.model"); + modelPackage = GlobalSettings.getProperty("swagger.codegen.undertow.modelpackage", "org.openapitools.model"); } else { - modelPackage = GeneratorProperties.getProperty("openapi.codegen.undertow.modelpackage", "org.openapitools.model"); + modelPackage = GlobalSettings.getProperty("openapi.codegen.undertow.modelpackage", "org.openapitools.model"); } additionalProperties.put("title", title); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java index f1420915317..ddc2cbf99c1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -60,6 +60,8 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen public static final String SWAGGER_ANNOTATIONS = "swaggerAnnotations"; public static final String SERVICE_INTERFACE = "serviceInterface"; public static final String SERVICE_IMPLEMENTATION = "serviceImplementation"; + public static final String REACTIVE = "reactive"; + private String basePackage; private String invokerPackage; @@ -72,6 +74,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen private boolean swaggerAnnotations = false; private boolean serviceInterface = false; private boolean serviceImplementation = false; + private boolean reactive = false; public KotlinSpringServerCodegen() { super(); @@ -92,55 +95,26 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen updateOption(CodegenConstants.ARTIFACT_ID, this.artifactId); // Use lists instead of arrays - typeMapping.put("array", "List"); - typeMapping.put("string", "String"); - typeMapping.put("boolean", "Boolean"); - typeMapping.put("integer", "Int"); - typeMapping.put("float", "Float"); - typeMapping.put("long", "Long"); - typeMapping.put("double", "Double"); - typeMapping.put("ByteArray", "ByteArray"); - typeMapping.put("list", "List"); - typeMapping.put("map", "Map"); - typeMapping.put("object", "Any"); - typeMapping.put("binary", "Array"); + typeMapping.put("array", "kotlin.collections.List"); + typeMapping.put("list", "kotlin.collections.List"); typeMapping.put("date", "java.time.LocalDate"); typeMapping.put("date-time", "java.time.OffsetDateTime"); typeMapping.put("Date", "java.time.LocalDate"); typeMapping.put("DateTime", "java.time.OffsetDateTime"); - importMapping.put("Date", "java.time.LocalDate"); - importMapping.put("DateTime", "java.time.OffsetDateTime"); - // use resource for file handling typeMapping.put("file", "org.springframework.core.io.Resource"); - - languageSpecificPrimitives.addAll(Arrays.asList( - "Any", - "Byte", - "ByteArray", - "Short", - "Int", - "Long", - "Float", - "Double", - "Boolean", - "Char", - "String", - "Array", - "List", - "Map", - "Set" - )); + importMapping.put("Date", "java.time.LocalDate"); + importMapping.put("DateTime", "java.time.OffsetDateTime"); addOption(TITLE, "server title name or client service name", title); addOption(BASE_PACKAGE, "base package (invokerPackage) for generated code", basePackage); addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort); addOption(CodegenConstants.MODEL_PACKAGE, "model package for generated code", modelPackage); addOption(CodegenConstants.API_PACKAGE, "api package for generated code", apiPackage); - addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers", exceptionHandler); + addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )", exceptionHandler); addSwitch(GRADLE_BUILD_FILE, "generate a gradle build file using the Kotlin DSL", gradleBuildFile); addSwitch(SWAGGER_ANNOTATIONS, "generate swagger annotations to go alongside controllers and models", swaggerAnnotations); addSwitch(SERVICE_INTERFACE, "generate service interfaces to go alongside controllers. In most " + @@ -149,7 +123,7 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " + "interfaces. If this is set to true service interfaces will also be generated", serviceImplementation); addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation); - + addSwitch(REACTIVE, "use coroutines for reactive behavior", reactive); supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application."); setLibrary(SPRING_BOOT); @@ -240,6 +214,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen this.useBeanValidation = useBeanValidation; } + public boolean isReactive() { + return reactive; + } + + public void setReactive(boolean reactive) { + this.reactive = reactive; + } + @Override public CodegenType getTag() { return CodegenType.SERVER; @@ -332,6 +314,14 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen } writePropertyBack(USE_BEANVALIDATION, useBeanValidation); + if (additionalProperties.containsKey(REACTIVE) && library.equals(SPRING_BOOT)) { + this.setReactive(convertPropertyToBoolean(REACTIVE)); + // spring webflux doesn't support @ControllerAdvice + this.setExceptionHandler(false); + } + writePropertyBack(REACTIVE, reactive); + writePropertyBack(EXCEPTION_HANDLER, exceptionHandler); + modelTemplateFiles.put("model.mustache", ".kt"); apiTemplateFiles.put("api.mustache", ".kt"); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); @@ -524,16 +514,16 @@ public class KotlinSpringServerCodegen extends AbstractKotlinCodegen private void doDataTypeAssignment(final String returnType, DataTypeAssigner dataTypeAssigner) { if (returnType == null) { dataTypeAssigner.setReturnType("Unit"); - } else if (returnType.startsWith("List")) { + } else if (returnType.startsWith("kotlin.collections.List")) { int end = returnType.lastIndexOf(">"); if (end > 0) { - dataTypeAssigner.setReturnType(returnType.substring("List<".length(), end).trim()); + dataTypeAssigner.setReturnType(returnType.substring("kotlin.collections.List<".length(), end).trim()); dataTypeAssigner.setReturnContainer("List"); } - } else if (returnType.startsWith("Map")) { + } else if (returnType.startsWith("kotlin.collections.Map")) { int end = returnType.lastIndexOf(">"); if (end > 0) { - dataTypeAssigner.setReturnType(returnType.substring("Map<".length(), end).split(",")[1].trim()); + dataTypeAssigner.setReturnType(returnType.substring("kotlin.collections.Map<".length(), end).split(",")[1].trim()); dataTypeAssigner.setReturnContainer("Map"); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java index 896f0837e57..7311569bc5d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/NodeJSServerCodegen.java @@ -27,7 +27,9 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.Paths; import io.swagger.v3.oas.models.info.Info; import org.openapitools.codegen.*; -import org.openapitools.codegen.config.GeneratorProperties; +import org.openapitools.codegen.config.GlobalSettings; +import org.openapitools.codegen.meta.GeneratorMetadata; +import org.openapitools.codegen.meta.Stability; import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -58,6 +60,11 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig public NodeJSServerCodegen() { super(); + // mark the generator as deprecated in the documentation + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) + .stability(Stability.DEPRECATED) + .build(); + // set the output folder here outputFolder = "generated-code/nodejs"; @@ -142,7 +149,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig */ @Override public String getName() { - return "nodejs-server"; + return "nodejs-server-deprecated"; } /** @@ -153,7 +160,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig */ @Override public String getHelp() { - return "Generates a nodejs server library using the swagger-tools project. By default, " + + return "[DEPRECATED] Generates a nodejs server library using the swagger-tools project. By default, " + "it will also generate service classes--which you can disable with the `-Dnoservice` environment variable."; } @@ -303,6 +310,8 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig message.append(System.lineSeparator()).append(System.lineSeparator()) .append("=======================================================================================") .append(System.lineSeparator()) + .append("IMPORTANT: The nodejs-server generator has been deprecated.") + .append(System.lineSeparator()) .append("Currently, Node.js server doesn't work as its dependency doesn't support OpenAPI Spec3.") .append(System.lineSeparator()) .append("For further details, see https://github.com/OpenAPITools/openapi-generator/issues/34") @@ -340,7 +349,7 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig } writeOptional(outputFolder, new SupportingFile("package.mustache", "", "package.json")); writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); - if (GeneratorProperties.getProperty("noservice") == null) { + if (GlobalSettings.getProperty("noservice") == null) { apiTemplateFiles.put( "service.mustache", // the template to use "Service.js"); // the extension for each file to write diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java index cf0de2dcb69..e0d2a98294f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/OpenAPIYamlGenerator.java @@ -28,7 +28,7 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi private static final Logger LOGGER = LoggerFactory.getLogger(OpenAPIYamlGenerator.class); - protected String outputFile = "openapi.yaml"; + protected String outputFile = "openapi/openapi.yaml"; public OpenAPIYamlGenerator() { super(); @@ -36,9 +36,6 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi outputFolder = "generated-code/openapi-yaml"; cliOptions.add(new CliOption(OUTPUT_NAME, "output filename")); supportingFiles.add(new SupportingFile("README.md", "", "README.md")); - supportingFiles.add(new SupportingFile("openapi.mustache", - "openapi", - "openapi.yaml")); } @Override @@ -56,13 +53,14 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi return "Creates a static openapi.yaml file (OpenAPI spec v3)."; } - @Override public void processOpts() { super.processOpts(); if (additionalProperties.containsKey(OUTPUT_NAME)) { - this.outputFile = additionalProperties.get(OUTPUT_NAME).toString(); + outputFile = additionalProperties.get(OUTPUT_NAME).toString(); } + LOGGER.info("Output file [outputFile={}]", outputFile); + supportingFiles.add(new SupportingFile("openapi.mustache", outputFile)); } @Override @@ -71,7 +69,6 @@ public class OpenAPIYamlGenerator extends DefaultCodegen implements CodegenConfi return super.postProcessSupportingFileData(objs); } - @Override public String escapeQuotationMark(String input) { // just return the original string diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java index 673ab32669d..7036c71507e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java @@ -167,6 +167,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml")); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index 443bb43863e..0ce2cee9914 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -103,8 +103,10 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("file", "data.frame"); typeMapping.put("binary", "data.frame"); typeMapping.put("ByteArray", "character"); - typeMapping.put("map", "object"); + typeMapping.put("map", "map"); + typeMapping.put("object", "object"); + importMapping.clear(); cliOptions.clear(); cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "R package name (convention: lowercase).") .defaultValue("openapi")); @@ -288,10 +290,10 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { if (ModelUtils.isArraySchema(p)) { ArraySchema ap = (ArraySchema) p; Schema inner = ap.getItems(); - return getTypeDeclaration(inner); + return getSchemaType(p) + "[" + getTypeDeclaration(inner)+ "]"; } else if (ModelUtils.isMapSchema(p)) { Schema inner = ModelUtils.getAdditionalProperties(p); - return getTypeDeclaration(inner); + return getSchemaType(p) + "(" + getTypeDeclaration(inner) + ")"; } // Not using the supertype invocation, because we want to UpperCamelize diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index a1f12a54f04..e7af53297f3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -91,7 +91,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { // local variable names used in API methods (endpoints) for (String word : Arrays.asList( "local_var_path", "query_params", "header_params", "_header_accept", "_header_accept_result", - "_header_content_type", "form_params", "post_body", "auth_names")) { + "_header_content_type", "form_params", "post_body", "auth_names", "send")) { reservedWords.add(word.toLowerCase(Locale.ROOT)); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 03b0c865eae..6bd358bd234 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -123,8 +123,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { // TODO(bcourtine): review file mapping. // I tried to map as "std::io::File", but Reqwest multipart file requires a "AsRef" param. // Getting a file from a Path is simple, but the opposite is difficult. So I map as "std::path::Path". - // Reference is required here because Path does not implement the "Sized" trait. - typeMapping.put("file", "&std::path::Path"); + typeMapping.put("file", "std::path::PathBuf"); typeMapping.put("binary", "::models::File"); typeMapping.put("ByteArray", "String"); typeMapping.put("object", "Value"); @@ -151,6 +150,12 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { setLibrary(HYPER_LIBRARY); } + @Override + public Map postProcessModels(Map objs) { + // process enum in models + return postProcessModelsEnum(objs); + } + @Override public void processOpts() { super.processOpts(); @@ -488,25 +493,25 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumVarName(String name, String datatype) { if (name.length() == 0) { - return "EMPTY"; + return "Empty"; } // number if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) { String varName = name; - varName = varName.replaceAll("-", "MINUS_"); - varName = varName.replaceAll("\\+", "PLUS_"); - varName = varName.replaceAll("\\.", "_DOT_"); + varName = varName.replaceAll("-", "Minus"); + varName = varName.replaceAll("\\+", "Plus"); + varName = varName.replaceAll("\\.", "Dot"); return varName; } // for symbol, e.g. $, # if (getSymbolName(name) != null) { - return getSymbolName(name).toUpperCase(Locale.ROOT); + return getSymbolName(name); } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(camelize(name)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -519,7 +524,9 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + // camelize the enum name + // phone_number => PhoneNumber + String enumName = camelize(toModelName(property.name)); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java index 0285e31ccf7..881b2cb6dc9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaPlayFrameworkServerCodegen.java @@ -358,7 +358,15 @@ public class ScalaPlayFrameworkServerCodegen extends AbstractScalaCodegen implem @Override public String toEnumName(CodegenProperty property) { - return camelize(property.name); + return camelizeStripReservedEscape(property.name); + } + + public String camelizeStripReservedEscape(String str) { + if (str.startsWith("`") && str.endsWith("`")) { + str = str.substring(1, str.length() - 1); + } + + return camelize(str); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java index fdaa2bce4e5..4e2c694fd8b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SpringCodegen.java @@ -21,7 +21,6 @@ import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.PathItem; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.*; import org.openapitools.codegen.languages.features.BeanValidationFeatures; @@ -117,7 +116,7 @@ public class SpringCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(INTERFACE_ONLY, "Whether to generate only API interface stubs without the server files.", interfaceOnly)); cliOptions.add(CliOption.newBoolean(DELEGATE_PATTERN, "Whether to generate the server files using the delegate pattern", delegatePattern)); cliOptions.add(CliOption.newBoolean(SINGLE_CONTENT_TYPES, "Whether to select only one produces/consumes content-type by operation.", singleContentTypes)); - cliOptions.add(CliOption.newBoolean(JAVA_8, "use java8 default interface", java8)); + updateJava8CliOptions(); cliOptions.add(CliOption.newBoolean(ASYNC, "use async Callable controllers", async)); cliOptions.add(CliOption.newBoolean(REACTIVE, "wrap responses in Mono/Flux Reactor types (spring-boot only)", reactive)); cliOptions.add(new CliOption(RESPONSE_WRAPPER, "wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type)")); @@ -142,6 +141,13 @@ public class SpringCodegen extends AbstractJavaCodegen } + private void updateJava8CliOptions() { + CliOption option = cliOptions.stream().filter(o -> JAVA_8.equals(o.getOpt())).findFirst() + .orElseThrow(() -> new RuntimeException("Missing java8 option")); + Map java8ModeOptions = option.getEnum(); + java8ModeOptions.put("true", "Use Java 8 classes such as Base64. Use java8 default interface when a responseWrapper is used"); + } + @Override public CodegenType getTag() { return CodegenType.SERVER; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java index 814035e9e81..15c29299696 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java @@ -42,7 +42,10 @@ import java.util.stream.Collectors; public class ModelUtils { private static final Logger LOGGER = LoggerFactory.getLogger(ModelUtils.class); + private static final String URI_FORMAT = "uri"; + + // TODO: Use GlobalSettings for all static/global properties in a more thread-safe way. private static boolean generateAliasAsModel = false; public static void setGenerateAliasAsModel(boolean value) { diff --git a/modules/openapi-generator/src/main/resources/Java/README.mustache b/modules/openapi-generator/src/main/resources/Java/README.mustache index 1a487fc280a..ff0026651fe 100644 --- a/modules/openapi-generator/src/main/resources/Java/README.mustache +++ b/modules/openapi-generator/src/main/resources/Java/README.mustache @@ -84,14 +84,12 @@ import {{{invokerPackage}}}.auth.*; import {{{modelPackage}}}.*; import {{{package}}}.{{{classname}}}; -import java.io.File; -import java.util.*; - public class {{{classname}}}Example { public static void main(String[] args) { - {{#hasAuthMethods}}ApiClient defaultClient = Configuration.getDefaultApiClient(); - {{#authMethods}}{{#isBasic}} + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} // Configure HTTP basic authorization: {{{name}}} HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); {{{name}}}.setUsername("YOUR USERNAME"); @@ -107,7 +105,7 @@ public class {{{classname}}}Example { {{/authMethods}} {{/hasAuthMethods}} - {{{classname}}} apiInstance = new {{{classname}}}(); + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); {{#allParams}} {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} {{/allParams}} @@ -116,6 +114,9 @@ public class {{{classname}}}Example { System.out.println(result);{{/returnType}} } catch (ApiException e) { System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); e.printStackTrace(); } } diff --git a/modules/openapi-generator/src/main/resources/Java/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/api_doc.mustache index bffe140b315..3a9d2886266 100644 --- a/modules/openapi-generator/src/main/resources/Java/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api_doc.mustache @@ -23,41 +23,50 @@ Method | HTTP request | Description ### Example ```java -// Import classes:{{#hasAuthMethods}} -//import {{{invokerPackage}}}.ApiClient;{{/hasAuthMethods}} -//import {{{invokerPackage}}}.ApiException;{{#hasAuthMethods}} -//import {{{invokerPackage}}}.Configuration; -//import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} -//import {{{package}}}.{{{classname}}}; +// Import classes: +import {{{invokerPackage}}}.ApiClient; +import {{{invokerPackage}}}.ApiException; +import {{{invokerPackage}}}.Configuration;{{#hasAuthMethods}} +import {{{invokerPackage}}}.auth.*;{{/hasAuthMethods}} +import {{{invokerPackage}}}.models.*; +import {{{package}}}.{{{classname}}}; -{{#hasAuthMethods}} -ApiClient defaultClient = Configuration.getDefaultApiClient(); -{{#authMethods}}{{#isBasic}} -// Configure HTTP basic authorization: {{{name}}} -HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); -{{{name}}}.setUsername("YOUR USERNAME"); -{{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}} -// Configure API key authorization: {{{name}}} -ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); -{{{name}}}.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} -// Configure OAuth2 access token for authorization: {{{name}}} -OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); -{{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} -{{/authMethods}} -{{/hasAuthMethods}} +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("{{{basePath}}}"); + {{#hasAuthMethods}} + {{#authMethods}}{{#isBasic}} + // Configure HTTP basic authorization: {{{name}}} + HttpBasicAuth {{{name}}} = (HttpBasicAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setUsername("YOUR USERNAME"); + {{{name}}}.setPassword("YOUR PASSWORD");{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + ApiKeyAuth {{{name}}} = (ApiKeyAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //{{{name}}}.setApiKeyPrefix("Token");{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + OAuth {{{name}}} = (OAuth) defaultClient.getAuthentication("{{{name}}}"); + {{{name}}}.setAccessToken("YOUR ACCESS TOKEN");{{/isOAuth}} + {{/authMethods}} + {{/hasAuthMethods}} -{{{classname}}} apiInstance = new {{{classname}}}(); -{{#allParams}} -{{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} -{{/allParams}} -try { - {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} - System.out.println(result);{{/returnType}} -} catch (ApiException e) { - System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); - e.printStackTrace(); + {{{classname}}} apiInstance = new {{{classname}}}(defaultClient); + {{#allParams}} + {{{dataType}}} {{{paramName}}} = {{{example}}}; // {{{dataType}}} | {{{description}}} + {{/allParams}} + try { + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{{paramName}}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + System.out.println(result);{{/returnType}} + } catch (ApiException e) { + System.err.println("Exception when calling {{{classname}}}#{{{operationId}}}"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -82,5 +91,14 @@ Name | Type | Description | Notes - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + {{/operation}} {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache index 9b19457b04c..1007a857ca0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiClient.mustache @@ -808,6 +808,8 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiResponse.mustache index 2f01685a0af..a67b11f054c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/ApiResponse.mustache @@ -4,6 +4,10 @@ package {{invokerPackage}}; import java.util.List; import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} /** * API response returned by API call. @@ -30,7 +34,13 @@ public class ApiResponse { */ public ApiResponse(int statusCode, Map> headers, T data) { this.statusCode = statusCode; - this.headers = headers; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; this.data = data; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache index a275689bba5..19c079e3229 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/api.mustache @@ -50,6 +50,15 @@ public class {{classname}} { * @return {{returnType}} {{/returnType}} * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} @@ -75,10 +84,17 @@ public class {{classname}} { {{#allParams}} * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} {{/allParams}} - {{#returnType}} * @return ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}> - {{/returnType}} * @throws ApiException if fails to make API call + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} {{#isDeprecated}} * @deprecated {{/isDeprecated}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/apiException.mustache new file mode 100644 index 00000000000..e8952456591 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/apiException.mustache @@ -0,0 +1,96 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +{{>generatedAnnotation}} +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 3c0af2dac5f..d8b553a434a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -170,6 +170,15 @@ jar + + + + http.response.details + a + Http Response Details: + + + @@ -226,6 +235,13 @@ jersey-client ${jersey-version} + {{^supportJava6}} + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + + {{/supportJava6}} org.glassfish.jersey.media jersey-media-multipart diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache index 3909393697c..1f3f3a31981 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiResponse.mustache @@ -4,6 +4,10 @@ package {{invokerPackage}}; import java.util.List; import java.util.Map; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} /** * API response returned by API call. @@ -30,7 +34,13 @@ public class ApiResponse { */ public ApiResponse(int statusCode, Map> headers, T data) { this.statusCode = statusCode; - this.headers = headers; + {{#caseInsensitiveResponseHeaders}} + Map> responseHeaders = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : headers.entrySet()){ + responseHeaders.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.headers = {{#caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}; this.data = data; } diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache new file mode 100644 index 00000000000..e8952456591 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/apiException.mustache @@ -0,0 +1,96 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import java.util.Map; +import java.util.List; +{{#caseInsensitiveResponseHeaders}} +import java.util.Map.Entry; +import java.util.TreeMap; +{{/caseInsensitiveResponseHeaders}} + +{{>generatedAnnotation}} +public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{ + private int code = 0; + private Map> responseHeaders = null; + private String responseBody = null; + + public ApiException() {} + + public ApiException(Throwable throwable) { + super(throwable); + } + + public ApiException(String message) { + super(message); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + public ApiException(int code, Map> responseHeaders, String responseBody) { + this((String) null, (Throwable) null, code, responseHeaders, responseBody); + } + + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + {{#caseInsensitiveResponseHeaders}} + Map> headers = new TreeMap>(String.CASE_INSENSITIVE_ORDER); + for(Entry> entry : responseHeaders.entrySet()){ + headers.put(entry.getKey().toLowerCase(), entry.getValue()); + } + {{/caseInsensitiveResponseHeaders}} + this.responseHeaders = {{#caseInsensitiveResponseHeaders}}headers{{/caseInsensitiveResponseHeaders}}{{^caseInsensitiveResponseHeaders}}responseHeaders{{/caseInsensitiveResponseHeaders}}; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + public String getResponseBody() { + return responseBody; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 613c81a48be..cb0e972ae37 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -126,15 +126,15 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp3:okhttp:3.13.1' - compile 'com.squareup.okhttp3:logging-interceptor:3.13.1' + compile 'io.swagger:swagger-annotations:1.5.22' + compile 'com.squareup.okhttp3:okhttp:3.14.2' + compile 'com.squareup.okhttp3:logging-interceptor:3.14.2' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.3' {{#hasOAuthMethods}} compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' {{/hasOAuthMethods}} - compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' {{#joda}} compile 'joda-time:joda-time:2.9.9' {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache index f83f149e920..80a53397e3a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.sbt.mustache @@ -9,11 +9,11 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp3" % "okhttp" % "3.13.1", - "com.squareup.okhttp3" % "logging-interceptor" % "3.13.1", + "io.swagger" % "swagger-annotations" % "1.5.22", + "com.squareup.okhttp3" % "okhttp" % "3.14.2", + "com.squareup.okhttp3" % "logging-interceptor" % "3.14.2", "com.google.code.gson" % "gson" % "2.8.5", - "org.apache.commons" % "commons-lang3" % "3.8.1", + "org.apache.commons" % "commons-lang3" % "3.9", {{#hasOAuthMethods}} "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", {{/hasOAuthMethods}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index eac0a4e1ba2..84b97f52c77 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -298,9 +298,9 @@ ${java.version} 1.8.3 1.5.21 - 3.14.0 + 3.14.2 2.8.5 - 3.8.1 + 3.9 {{#joda}} 2.9.9 {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache index 637a710a51d..5c396de030c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache @@ -94,6 +94,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + {{/useSpringfox}} {{^useSpringfox}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache index aafc216dba0..dc9c843bc2b 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache @@ -137,6 +137,16 @@ spring-web ${spring-version} + + javax.annotation + javax.annotation-api + 1.3.2 + + + javax.xml.bind + jaxb-api + 2.2.11 + {{#useSpringfox}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache index 55e9558ec70..9bf21463079 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/queryParams.mustache @@ -1 +1 @@ -{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{^isContainer}}{{#defaultValue}}, defaultValue = {{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}}{{^isModel}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{^isContainer}}{{#defaultValue}}, defaultValue={{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{{defaultValue}}}{{^isString}}"{{/isString}}{{#isString}}{{#isEnum}}"{{/isEnum}}{{/isString}}{{/defaultValue}}{{/isContainer}}){{/isModel}} {{>optionalDataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/README.mustache b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/README.mustache index f13c6322bb9..e93ab6f53dd 100644 --- a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/README.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/README.mustache @@ -18,7 +18,8 @@ Module system To build an compile the flow typed sources to javascript use: ``` npm install -npm run build +# The dependency `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables +env BABEL_ENV={YOUR_ENV} npm run build ``` ### Publishing diff --git a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/babelrc b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/babelrc index 75148dc5edb..4bf17b5e66e 100644 --- a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/babelrc +++ b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/babelrc @@ -1,4 +1,9 @@ { - "presets": ["react-app"], - "plugins": ["transform-flow-strip-types"] + "presets": [ + "react-app", + "@babel/preset-flow" + ], + "plugins": [ + "@babel/plugin-transform-flow-strip-types" + ] } diff --git a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/package.mustache b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/package.mustache index eed7d2042df..b8f07e12eec 100644 --- a/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/package.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript-Flowtyped/package.mustache @@ -27,10 +27,11 @@ "portable-fetch": "^3.0.0" }, "devDependencies": { - "babel-cli": "^6.26.0", - "babel-core": "^6.26.3", - "babel-plugin-transform-flow-strip-types": "^6.22.0", - "babel-preset-react-app": "^3.1.1", + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/plugin-transform-flow-strip-types": "^7.0.0", + "@babel/preset-flow": "^7.0.0", + "babel-preset-react-app": "^7.0.0", "flow-copy-source": "^1.3.0", "rimraf": "^2.6.2" } diff --git a/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache index 6fb2e025160..64c0fab0fd5 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache @@ -651,7 +651,8 @@ ]; }; - exports.getBasePathFromSettings = function(index, variables={}) { + exports.getBasePathFromSettings = function(index, variables) { + var variables = variables || {}; var servers = this.hostSettings(); // check array index out of bound diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache new file mode 100644 index 00000000000..8f266775e13 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Authentication/ApiAuthentication.mustache @@ -0,0 +1,60 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace {{packageName}}.Authentication +{ + public class ApiKeyRequirement : IAuthorizationRequirement + { + public IReadOnlyList ApiKeys { get; set; } + + public string PolicyName { get; set; } + + public ApiKeyRequirement(IEnumerable apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List(); + PolicyName = policyName; + } + } + + public class ApiKeyRequirementHandler : AuthorizationHandler + { + + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { +{{#authMethods}}{{#isApiKey}} +{{#-first}} + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { + var apiKey = ""; +{{/-first}} +{{#isKeyInHeader}} + apiKey = authorizationFilterContext.HttpContext.Request.Headers["{{keyParamName}}"].FirstOrDefault(); +{{/isKeyInHeader}} +{{#isKeyInQuery}} + apiKey = authorizationFilterContext.HttpContext.Request.Query["{{keyParamName}}"].FirstOrDefault(); +{{/isKeyInQuery}} +{{#isKeyInCookie}} + apiKey = authorizationFilterContext.HttpContext.Request.Cookies["{{keyParamName}}"] ?? null; +{{/isKeyInCookie}} + if (requirement.PolicyName == "{{name}}" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } +{{#-last}} + } +{{/-last}} +{{/isApiKey}}{{/authMethods}} + } + } +} + diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache index 3714e878dc4..a7b6b35bd78 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache @@ -12,10 +12,20 @@ {{packageName}} +{{#useFrameworkReference}} +{{#isLibrary}} + +{{/isLibrary}} +{{/useFrameworkReference}} +{{^useFrameworkReference}} +{{/useFrameworkReference}} +{{#useNewtonsoft}} + +{{/useNewtonsoft}} {{#useSwashbuckle}} - - + + {{/useSwashbuckle}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache index 3352c113c4a..98fb1fe23e6 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache @@ -12,6 +12,8 @@ using Newtonsoft.Json.Serialization;{{#useSwashbuckle}} using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; using {{packageName}}.Filters;{{/useSwashbuckle}} +using {{packageName}}.Authentication; +using Microsoft.AspNetCore.Authorization; namespace {{packageName}} { @@ -40,18 +42,34 @@ namespace {{packageName}} /// public void ConfigureServices(IServiceCollection services) { +{{#authMethods}} +{{#isApiKey}} +{{#-first}} + services.AddTransient(); + services.AddAuthorization(authConfig => + { +{{/-first}} + authConfig.AddPolicy("{{name}}", + policyBuilder => policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"{{name}}"))); +{{#-last}} + }); +{{/-last}} +{{/isApiKey}} +{{/authMethods}} + // Add framework services. services - .AddMvc() + .AddMvc({{^useDefaultRoutng}}opts => opts.EnableEndpointRouting = false{{/useDefaultRoutng}}) {{#compatibilityVersion}} .SetCompatibilityVersion(CompatibilityVersion.{{compatibilityVersion}}) {{/compatibilityVersion}} - .AddJsonOptions(opts => + .{{#useNewtonsoft}}AddNewtonsoftJson{{/useNewtonsoft}}{{^useNewtonsoft}}AddJsonOptions{{/useNewtonsoft}}(opts => { opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); opts.SerializerSettings.Converters.Add(new StringEnumConverter { - CamelCaseText = true + {{#useNewtonsoft}}NamingStrategy = new CamelCaseNamingStrategy(){{/useNewtonsoft}}{{^useNewtonsoft}}CamelCaseText = true{{/useNewtonsoft}} }); }); {{#useSwashbuckle}} @@ -109,7 +127,12 @@ namespace {{packageName}} //TODO: Or alternatively use the original Swagger contract that's included in the static files // c.SwaggerEndpoint("/openapi-original.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} Original"); - }){{/useSwashbuckle}}; + }){{/useSwashbuckle}};{{^useDefaultRoutng}} + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapControllers(); + });{{/useDefaultRoutng}} if (env.IsDevelopment()) { diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache index dec27299ffc..0c136c8a8b8 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache @@ -14,6 +14,7 @@ using Newtonsoft.Json; {{/isLibrary}} using System.ComponentModel.DataAnnotations; using {{packageName}}.Attributes; +using Microsoft.AspNetCore.Authorization; using {{modelPackage}}; namespace {{apiPackage}} @@ -32,7 +33,9 @@ namespace {{apiPackage}} /// {{description}}{{/allParams}}{{#responses}} /// {{message}}{{/responses}} [{{httpMethod}}] - [Route("{{{basePathWithoutHost}}}{{{path}}}")] + [Route("{{{basePathWithoutHost}}}{{{path}}}")]{{#hasAuthMethods}}{{#authMethods}}{{#isApiKey}} + [Authorize(Policy = "{{name}}")]{{/isApiKey}}{{#isBasicBearer}} + [Authorize{{#hasScopes}}(Roles = "{{#scopes}}{{scope}}{{#hasMore}},{{/hasMore}}{{/scopes}}"){{/hasScopes}}]{{/isBasicBearer}}{{/authMethods}}{{/hasAuthMethods}} [ValidateModelState]{{#useSwashbuckle}} [SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}} [SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}}{{^useSwashbuckle}}{{#responses}}{{#dataType}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache index 85b84385b73..b8858070611 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache @@ -13,7 +13,7 @@ #include #include #include -{{^hasModelImport}}#include "json.hpp"{{/hasModelImport}} +{{^hasModelImport}}#include {{/hasModelImport}} {{#imports}}{{{import}}} {{/imports}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache index 6c61ca461e6..f9c036f8207 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.cpp.mustache @@ -45,18 +45,29 @@ void {{prefix}}HttpRequestInput::add_file(QString variable_name, QString local_f : QObject(parent), manager(nullptr) { qsrand(QDateTime::currentDateTime().toTime_t()); - + timeout = 0; + timer = new QTimer(); manager = new QNetworkAccessManager(this); connect(manager, &QNetworkAccessManager::finished, this, &{{prefix}}HttpRequestWorker::on_manager_finished); } {{prefix}}HttpRequestWorker::~{{prefix}}HttpRequestWorker() { + if(timer != nullptr){ + if(timer->isActive()){ + timer->stop(); + } + timer->deleteLater(); + } } QMap {{prefix}}HttpRequestWorker::getResponseHeaders() const { return headers; } +void {{prefix}}HttpRequestWorker::setTimeOut(int tout){ + timeout = tout; +} + QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -108,7 +119,7 @@ QString {{prefix}}HttpRequestWorker::http_attribute_encode(QString attribute_nam void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { // reset variables - + QNetworkReply* reply = nullptr; QByteArray request_content = ""; response = ""; error_type = QNetworkReply::NoError; @@ -276,19 +287,19 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { } if (input->http_method == "GET") { - manager->get(request); + reply = manager->get(request); } else if (input->http_method == "POST") { - manager->post(request, request_content); + reply = manager->post(request, request_content); } else if (input->http_method == "PUT") { - manager->put(request, request_content); + reply = manager->put(request, request_content); } else if (input->http_method == "HEAD") { - manager->head(request); + reply = manager->head(request); } else if (input->http_method == "DELETE") { - manager->deleteResource(request); + reply = manager->deleteResource(request); } else { #if (QT_VERSION >= 0x050800) @@ -298,11 +309,16 @@ void {{prefix}}HttpRequestWorker::execute({{prefix}}HttpRequestInput *input) { buffer->setData(request_content); buffer->open(QIODevice::ReadOnly); - QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); buffer->setParent(reply); #endif } - + if(timeout > 0){ + timer->setSingleShot(true); + timer->setInterval(timeout); + connect(timer, &QTimer::timeout, this, [=](){ on_manager_timeout(reply); }); + timer->start(); + } } void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { @@ -318,6 +334,16 @@ void {{prefix}}HttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } +void {{prefix}}HttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { + error_type = QNetworkReply::TimeoutError; + response = ""; + error_str = "Timed out waiting for response"; + disconnect(manager, nullptr, nullptr, nullptr); + reply->abort(); + reply->deleteLater(); + + emit on_execution_finished(this); +} QSslConfiguration* {{prefix}}HttpRequestWorker::sslDefaultConfiguration; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache index a8a50e266ab..6ba6b63117a 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/HttpRequest.h.mustache @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -60,7 +61,7 @@ public: QByteArray response; QNetworkReply::NetworkError error_type; QString error_str; - + QTimer *timer; explicit {{prefix}}HttpRequestWorker(QObject *parent = nullptr); virtual ~{{prefix}}HttpRequestWorker(); @@ -68,16 +69,17 @@ public: QString http_attribute_encode(QString attribute_name, QString input); void execute({{prefix}}HttpRequestInput *input); static QSslConfiguration* sslDefaultConfiguration; - + void setTimeOut(int tout); signals: void on_execution_finished({{prefix}}HttpRequestWorker *worker); private: QNetworkAccessManager *manager; QMap headers; + int timeout; + void on_manager_timeout(QNetworkReply *reply); private slots: - void on_manager_finished(QNetworkReply *reply); - + void on_manager_finished(QNetworkReply *reply); }; {{#cppNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache index c2355916bfa..899a16b0597 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-body.mustache @@ -10,7 +10,8 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} {{classname}}::{{classname}}() : basePath("{{{basePathWithoutHost}}}"), - host("{{#serverHost}}{{#scheme}}{{scheme}}://{{/scheme}}{{serverHost}}{{#serverPort}}:{{serverPort}}{{/serverPort}}{{/serverHost}}") { + host("{{#serverHost}}{{#scheme}}{{scheme}}://{{/scheme}}{{serverHost}}{{#serverPort}}:{{serverPort}}{{/serverPort}}{{/serverHost}}"), + timeout(0){ } @@ -18,9 +19,10 @@ namespace {{this}} { } -{{classname}}::{{classname}}(const QString& host, const QString& basePath) { +{{classname}}::{{classname}}(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; + this->timeout = tout; } void {{classname}}::setBasePath(const QString& basePath){ @@ -31,6 +33,10 @@ void {{classname}}::setHost(const QString& host){ this->host = host; } +void {{classname}}::setApiTimeOutMs(const int tout){ + timeout = tout; +} + void {{classname}}::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } @@ -97,6 +103,7 @@ void } {{/collectionFormat}}{{/queryParams}} {{prefix}}HttpRequestWorker *worker = new {{prefix}}HttpRequestWorker(); + worker->setTimeOut(timeout); {{prefix}}HttpRequestInput input(fullPath, "{{httpMethod}}"); {{#formParams}} if ({{paramName}} != nullptr) { diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache index a5fc0432b52..ea9218ad529 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/api-header.mustache @@ -18,11 +18,12 @@ class {{classname}}: public QObject { public: {{classname}}(); - {{classname}}(const QString& host, const QString& basePath); + {{classname}}(const QString& host, const QString& basePath, const int toutMs = 0); ~{{classname}}(); void setBasePath(const QString& basePath); void setHost(const QString& host); + void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); {{#operations}}{{#operation}}void {{nickname}}({{#allParams}}const {{{dataType}}}& {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); @@ -30,6 +31,7 @@ public: private: QString basePath; QString host; + int timeout; QMap defaultHeaders; {{#operations}}{{#operation}}void {{nickname}}Callback ({{prefix}}HttpRequestWorker * worker); {{/operation}}{{/operations}} @@ -38,9 +40,9 @@ signals: {{/operation}}{{/operations}} {{#operations}}{{#operation}}void {{nickname}}SignalFull({{prefix}}HttpRequestWorker* worker{{#returnType}}, {{{returnType}}} summary{{/returnType}}); {{/operation}}{{/operations}} - {{#operations}}{{#operation}}void {{nickname}}SignalE({{#returnType}}{{{returnType}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString& error_str); + {{#operations}}{{#operation}}void {{nickname}}SignalE({{#returnType}}{{{returnType}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString error_str); {{/operation}}{{/operations}} - {{#operations}}{{#operation}}void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + {{#operations}}{{#operation}}void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); {{/operation}}{{/operations}} }; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/enum.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/enum.mustache index 6e10a390b36..2874ef8c712 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/enum.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/enum.mustache @@ -4,6 +4,7 @@ #include #include +#include {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -54,4 +55,6 @@ private : } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Enum) + #endif // {{prefix}}_ENUM_H diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache index 9cb73bdb4d0..38b42f401a2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/model-header.mustache @@ -74,6 +74,8 @@ private: } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{classname}}) + #endif // {{classname}}_H {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-client/object.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-client/object.mustache index c0b2413118b..100670d1fc5 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-client/object.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-client/object.mustache @@ -4,6 +4,7 @@ #include #include +#include {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -56,4 +57,6 @@ private : } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Object) + #endif // {{prefix}}_OBJECT_H diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/enum.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/enum.mustache index 6e10a390b36..2874ef8c712 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/enum.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/enum.mustache @@ -4,6 +4,7 @@ #include #include +#include {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -54,4 +55,6 @@ private : } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Enum) + #endif // {{prefix}}_ENUM_H diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache index 9cb73bdb4d0..38b42f401a2 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-header.mustache @@ -74,6 +74,8 @@ private: } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{classname}}) + #endif // {{classname}}_H {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache index c0b2413118b..100670d1fc5 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache @@ -4,6 +4,7 @@ #include #include +#include {{#cppNamespaceDeclarations}} namespace {{this}} { @@ -56,4 +57,6 @@ private : } {{/cppNamespaceDeclarations}} +Q_DECLARE_METATYPE({{#cppNamespaceDeclarations}}{{this}}::{{/cppNamespaceDeclarations}}{{prefix}}Object) + #endif // {{prefix}}_OBJECT_H diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache index ffe56a5a0b7..56f1b070717 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/README.mustache @@ -80,7 +80,7 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p ## Getting Started ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using {{packageName}}.{{apiPackage}}; using {{packageName}}.Client; @@ -90,9 +90,10 @@ namespace Example { public class {{operationId}}Example { - public void main() + public static void Main() { {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} + Configuration.Default.BasePath = "{{{basePath}}}"; {{#hasAuthMethods}} {{#authMethods}} {{#isBasic}} @@ -113,7 +114,7 @@ namespace Example {{/authMethods}} {{/hasAuthMethods}} - var apiInstance = new {{classname}}(); + var apiInstance = new {{classname}}(Configuration.Default); {{#allParams}} {{#isPrimitiveType}} var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} @@ -128,12 +129,14 @@ namespace Example {{#summary}} // {{{.}}} {{/summary}} - {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} Debug.WriteLine(result);{{/returnType}} } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } {{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} } diff --git a/modules/openapi-generator/src/main/resources/csharp-netcore/api_doc.mustache b/modules/openapi-generator/src/main/resources/csharp-netcore/api_doc.mustache index 60bde9985e6..2eb7c9eb348 100644 --- a/modules/openapi-generator/src/main/resources/csharp-netcore/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/csharp-netcore/api_doc.mustache @@ -12,7 +12,7 @@ Method | HTTP request | Description {{#operation}} # **{{{operationId}}}** -> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{{summary}}}{{#notes}} @@ -20,7 +20,7 @@ Method | HTTP request | Description ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using {{packageName}}.{{apiPackage}}; using {{packageName}}.Client; @@ -30,8 +30,9 @@ namespace Example { public class {{operationId}}Example { - public void main() + public static void Main() { + Configuration.Default.BasePath = "{{{basePath}}}"; {{#hasAuthMethods}} {{#authMethods}} {{#isBasic}} @@ -52,7 +53,7 @@ namespace Example {{/authMethods}} {{/hasAuthMethods}} - var apiInstance = new {{classname}}(); + var apiInstance = new {{classname}}(Configuration.Default); {{#allParams}} {{#isPrimitiveType}} var {{paramName}} = {{{example}}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} @@ -67,12 +68,14 @@ namespace Example {{#summary}} // {{{.}}} {{/summary}} - {{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} Debug.WriteLine(result);{{/returnType}} } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -88,7 +91,7 @@ Name | Type | Description | Notes ### Return type -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} ### Authorization @@ -99,6 +102,15 @@ Name | Type | Description | Notes - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/csharp/Project.mustache b/modules/openapi-generator/src/main/resources/csharp/Project.mustache index e028c7b63cb..c5b763016f9 100644 --- a/modules/openapi-generator/src/main/resources/csharp/Project.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/Project.mustache @@ -69,16 +69,16 @@ - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - {{binRelativePath}}\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + {{binRelativePath}}\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll diff --git a/modules/openapi-generator/src/main/resources/csharp/README.mustache b/modules/openapi-generator/src/main/resources/csharp/README.mustache index be09f9d138a..fbf5001b1d2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/README.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/README.mustache @@ -102,6 +102,7 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p ## Getting Started ```csharp +using System.Collections.Generic; using System.Diagnostics; using {{packageName}}.{{apiPackage}}; using {{packageName}}.Client; diff --git a/modules/openapi-generator/src/main/resources/csharp/TestProject.mustache b/modules/openapi-generator/src/main/resources/csharp/TestProject.mustache index 598f90210a9..0b1f35a53db 100644 --- a/modules/openapi-generator/src/main/resources/csharp/TestProject.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/TestProject.mustache @@ -59,16 +59,16 @@ - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - {{binRelativePath}}\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll + {{binRelativePath}}\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll - {{binRelativePath}}\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll + {{binRelativePath}}\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll @@ -77,10 +77,10 @@ {{binRelativePath}}\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - {{binRelativePath}}\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + {{binRelativePath}}\NUnit.3.11.0\lib\net45\nunit.framework.dll
diff --git a/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache b/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache index 7971a78fb1c..df59f42415c 100644 --- a/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/api_doc.mustache @@ -14,7 +14,7 @@ Method | HTTP request | Description ## {{{operationId}}} -> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) +> {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {{{summary}}}{{#notes}} @@ -23,6 +23,7 @@ Method | HTTP request | Description ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using {{packageName}}.{{apiPackage}}; using {{packageName}}.Client; @@ -70,7 +71,7 @@ namespace Example {{#summary}} // {{{.}}} {{/summary}} - {{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + {{#returnType}}{{{returnType}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} Debug.WriteLine(result);{{/returnType}} } catch (ApiException e) @@ -94,7 +95,7 @@ Name | Type | Description | Notes ### Return type -{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{returnType}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} ### Authorization @@ -105,6 +106,15 @@ Name | Type | Description | Notes - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} +{{#responses.0}} +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +{{#responses}} +| **{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}} | +{{/responses}} +{{/responses.0}} + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/modules/openapi-generator/src/main/resources/csharp/api_test.mustache b/modules/openapi-generator/src/main/resources/csharp/api_test.mustache index 4b58b5b49f7..34aab0e2567 100644 --- a/modules/openapi-generator/src/main/resources/csharp/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/api_test.mustache @@ -22,7 +22,6 @@ namespace {{packageName}}.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class {{classname}}Tests { private {{classname}} instance; @@ -51,8 +50,8 @@ namespace {{packageName}}.Test [Test] public void {{operationId}}InstanceTest() { - // TODO uncomment below to test 'IsInstanceOfType' {{classname}} - //Assert.IsInstanceOfType(typeof({{classname}}), instance, "instance is a {{classname}}"); + // TODO uncomment below to test 'IsInstanceOf' {{classname}} + //Assert.IsInstanceOf(typeof({{classname}}), instance); } {{#operations}}{{#operation}} @@ -67,7 +66,7 @@ namespace {{packageName}}.Test //{{{dataType}}} {{paramName}} = null; {{/allParams}} //{{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); - {{#returnType}}//Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} + {{#returnType}}//Assert.IsInstanceOf(typeof({{{returnType}}}), response, "response is {{{returnType}}}");{{/returnType}} } {{/operation}}{{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/csharp/compile-mono.sh.mustache b/modules/openapi-generator/src/main/resources/csharp/compile-mono.sh.mustache index ce3fbe0b8ac..3271da17f82 100644 --- a/modules/openapi-generator/src/main/resources/csharp/compile-mono.sh.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/compile-mono.sh.mustache @@ -44,9 +44,9 @@ ${nuget_cmd} install src/{{packageName}}/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; -cp packages/Newtonsoft.Json.10.0.3/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.12.0.1/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.2.0/lib/{{targetFrameworkNuget}}/JsonSubTypes.dll bin/JsonSubTypes.dll +cp packages/JsonSubTypes.1.5.2/lib/{{targetFrameworkNuget}}/JsonSubTypes.dll bin/JsonSubTypes.dll {{#generatePropertyChanged}} cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll diff --git a/modules/openapi-generator/src/main/resources/csharp/compile.mustache b/modules/openapi-generator/src/main/resources/csharp/compile.mustache index a0c9c0aaa4c..13f4569714b 100644 --- a/modules/openapi-generator/src/main/resources/csharp/compile.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/compile.mustache @@ -15,8 +15,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.10.0.3\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.2.0\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll bin\JsonSubTypes.dll +copy packages\Newtonsoft.Json.12.0.1\lib\{{targetFrameworkNuget}}\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\JsonSubTypes.1.5.2\lib\{{targetFrameworkNuget}}\JsonSubTypes.dll bin\JsonSubTypes.dll copy packages\RestSharp.105.1.0\lib\{{#isNet40}}net4{{/isNet40}}{{^isNet40}}{{targetFrameworkNuget}}{{/isNet40}}\RestSharp.dll bin\RestSharp.dll {{#generatePropertyChanged}} copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll diff --git a/modules/openapi-generator/src/main/resources/csharp/model_test.mustache b/modules/openapi-generator/src/main/resources/csharp/model_test.mustache index 8bdab50696c..142737a6bb5 100644 --- a/modules/openapi-generator/src/main/resources/csharp/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/model_test.mustache @@ -23,7 +23,6 @@ namespace {{packageName}}.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class {{classname}}Tests { // TODO uncomment below to declare an instance variable for {{classname}} @@ -54,8 +53,8 @@ namespace {{packageName}}.Test [Test] public void {{classname}}InstanceTest() { - // TODO uncomment below to test "IsInstanceOfType" {{classname}} - //Assert.IsInstanceOfType<{{classname}}> (instance, "variable 'instance' is a {{classname}}"); + // TODO uncomment below to test "IsInstanceOf" {{classname}} + //Assert.IsInstanceOf(typeof({{classname}}), instance); } {{#discriminator}} @@ -67,7 +66,7 @@ namespace {{packageName}}.Test public void {{classname}}DeserializeFrom{{parent}}Test() { // TODO uncomment below to test deserialize a {{classname}} from type {{parent}} - //Assert.IsInstanceOf<{{parent}}>(JsonConvert.DeserializeObject<{{parent}}>(new {{classname}}().ToJson())); + //Assert.IsInstanceOf(typeof({{parent}}), JsonConvert.DeserializeObject<{{parent}}>(new {{classname}}().ToJson())); } {{/children}} {{/discriminator}} diff --git a/modules/openapi-generator/src/main/resources/csharp/mono_nunit_test.mustache b/modules/openapi-generator/src/main/resources/csharp/mono_nunit_test.mustache index f3e03dc803e..da9c06702cb 100644 --- a/modules/openapi-generator/src/main/resources/csharp/mono_nunit_test.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/mono_nunit_test.mustache @@ -14,9 +14,9 @@ wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe mozroots --import --sync mono nuget.exe install src/{{{packageName}}}.Test/packages.config -o packages -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +echo "[INFO] Install NUnit Console 3.x runners via NuGet" +mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild {{{packageName}}}.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/{{{packageName}}}.Test/bin/Debug/{{{packageName}}}.Test.dll diff --git a/modules/openapi-generator/src/main/resources/csharp/nuspec.mustache b/modules/openapi-generator/src/main/resources/csharp/nuspec.mustache index e061877340d..003928a31a3 100644 --- a/modules/openapi-generator/src/main/resources/csharp/nuspec.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/nuspec.mustache @@ -30,8 +30,8 @@ - - + + {{#generatePropertyChanged}} diff --git a/modules/openapi-generator/src/main/resources/csharp/packages.config.mustache b/modules/openapi-generator/src/main/resources/csharp/packages.config.mustache index 57234ce284b..c8d4841e60f 100644 --- a/modules/openapi-generator/src/main/resources/csharp/packages.config.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/packages.config.mustache @@ -1,8 +1,8 @@ - - + + {{#generatePropertyChanged}} diff --git a/modules/openapi-generator/src/main/resources/csharp/packages_test.config.mustache b/modules/openapi-generator/src/main/resources/csharp/packages_test.config.mustache index 5e08ad3b671..8ebdecf06b2 100644 --- a/modules/openapi-generator/src/main/resources/csharp/packages_test.config.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/packages_test.config.mustache @@ -1,7 +1,7 @@ - + - - + + diff --git a/modules/openapi-generator/src/main/resources/csharp/project.json.mustache b/modules/openapi-generator/src/main/resources/csharp/project.json.mustache index 194fdda4495..29ad6d85693 100644 --- a/modules/openapi-generator/src/main/resources/csharp/project.json.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/project.json.mustache @@ -3,10 +3,10 @@ "dependencies": { "FubarCoder.RestSharp.Portable.Core": "4.0.7", "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", - "Newtonsoft.Json": "10.0.3", - "JsonSubTypes": "1.2.0" + "Newtonsoft.Json": "12.0.1", + "JsonSubTypes": "1.5.2" }, "frameworks": { "{{targetFrameworkNuget}}": {} } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index fe72ace87e7..1a6a8f04343 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -7,7 +7,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" {{#imports}} "{{import}}" {{/imports}} ) @@ -66,7 +65,7 @@ type {{{nickname}}}Opts struct { {{/hasOptionalParams}} func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("{{httpMethod}}") + localVarHttpMethod = http.Method{{httpMethod}} localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 71db41037b2..c67976ea72f 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -244,6 +244,16 @@ func (c *APIClient) prepareRequest( return nil, err } + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + // Adding Query Param query := url.Query() for k, v := range queryParams { @@ -274,11 +284,6 @@ func (c *APIClient) prepareRequest( localVarRequest.Header = headers } - // Override request host, if applicable - if c.cfg.Host != "" { - localVarRequest.Host = c.cfg.Host - } - // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) diff --git a/modules/openapi-generator/src/main/resources/go/go.mod.mustache b/modules/openapi-generator/src/main/resources/go/go.mod.mustache index bc919e42e0e..ec4310dd593 100644 --- a/modules/openapi-generator/src/main/resources/go/go.mod.mustache +++ b/modules/openapi-generator/src/main/resources/go/go.mod.mustache @@ -1,4 +1,4 @@ -module github.com/{{gitUserId}}/{{gitRepoId}} +module github.com/{{gitUserId}}/{{gitRepoId}}{{#isGoSubmodule}}/{{packageName}}{{/isGoSubmodule}} require ( github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6 diff --git a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/AppMain.kt.mustache b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/AppMain.kt.mustache index 9c1b3084712..03ef4296bfe 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/AppMain.kt.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-server/libraries/ktor/AppMain.kt.mustache @@ -21,10 +21,10 @@ import io.ktor.locations.Locations import io.ktor.metrics.Metrics import io.ktor.routing.Routing import java.util.concurrent.TimeUnit +import io.ktor.util.KtorExperimentalAPI {{#hasAuthMethods}} import io.ktor.auth.Authentication import io.ktor.auth.oauth -import io.ktor.util.KtorExperimentalAPI import org.openapitools.server.infrastructure.ApiKeyCredential import org.openapitools.server.infrastructure.ApiPrincipal import org.openapitools.server.infrastructure.apiKeyAuth diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache index 83c84799b30..ba8597ee9fd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -14,7 +14,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController {{#useBeanValidation}} import org.springframework.validation.annotation.Validated {{/useBeanValidation}} @@ -39,10 +40,13 @@ import javax.validation.constraints.Pattern import javax.validation.constraints.Size {{/useBeanValidation}} +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController {{#useBeanValidation}} @Validated {{/useBeanValidation}} @@ -68,12 +72,12 @@ class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) v value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}}]){{/swaggerAnnotations}} @RequestMapping( value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"],{{#singleContentTypes}}{{#hasProduces}} - produces = "{{{vendorExtensions.x-accepts}}}", {{/hasProduces}}{{#hasConsumes}} + produces = "{{{vendorExtensions.x-accepts}}}",{{/hasProduces}}{{#hasConsumes}} consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} - produces = [{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}} - consumes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}} + produces = [{{#produces}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}} + consumes = [{{#consumes}}"{{{mediaType}}}"{{^-last}}, {{/-last}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}} method = [RequestMethod.{{httpMethod}}]) - fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { + {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { return {{>returnValue}} } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache index f94e84c24de..fc21b3353cc 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api_test.mustache @@ -4,6 +4,10 @@ package {{package}} {{/imports}} import org.junit.jupiter.api.Test +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +import kotlinx.coroutines.test.runBlockingTest +{{/reactive}} import org.springframework.http.ResponseEntity class {{classname}}Test { @@ -21,7 +25,7 @@ class {{classname}}Test { * if the Api call fails */ @Test - fun {{operationId}}Test() { + fun {{operationId}}Test() {{#reactive}}= runBlockingTest {{/reactive}}{ {{#allParams}} val {{paramName}}:{{{dataType}}}? = null {{/allParams}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache index c05599c7b02..9d51d6d8c04 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache index 571f0179fa5..dac8996120d 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,18 +23,26 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") +{{^reactive}} compile("org.springframework.boot:spring-boot-starter-web") +{{/reactive}} +{{#reactive}} + compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") +{{/reactive}} {{#swaggerAnnotations}} compile("io.swagger:swagger-annotations:1.5.21") {{/swaggerAnnotations}} @@ -46,4 +54,13 @@ dependencies { testCompile("org.springframework.boot:spring-boot-starter-test") { exclude(module = "junit") } +{{#reactive}} + testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion") +{{/reactive}} +} + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } } diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache index e552565e4a4..bd651585009 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -6,12 +6,13 @@ {{artifactId}} {{artifactVersion}} - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin @@ -77,8 +78,26 @@ org.springframework.boot +{{^reactive}} spring-boot-starter-web +{{/reactive}} +{{#reactive}} + spring-boot-starter-webflux +{{/reactive}} +{{#reactive}} + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + +{{/reactive}} + {{#swaggerAnnotations}} io.swagger @@ -116,4 +135,34 @@ test + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache index b8fd6c4c41f..290868e2793 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "{{artifactId}}" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache index 67d79cc198c..498e0aab4fd 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache @@ -1 +1 @@ -{{#isMapContainer}}{{#reactive}}Mono<{{/reactive}}Map{{/reactive}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{#reactive}}Mono<{{{returnType}}}>{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}}{{/returnContainer}} \ No newline at end of file +{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flow{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache index 4973c83431d..d2bea4c365f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache @@ -1 +1 @@ -{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), HttpStatus.OK){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}} \ No newline at end of file +{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), {{#responses}}{{#-first}}HttpStatus.valueOf({{code}}){{/-first}}{{/responses}}){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache index 12b073f7009..e9abca8eba2 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache @@ -2,12 +2,14 @@ package {{package}} {{#imports}}import {{import}} {{/imports}} - +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} {{#operations}} interface {{classname}}Service { {{#operation}} - fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} + {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} {{/operation}} } {{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache index 32e62866af2..b110e81378f 100644 --- a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache @@ -2,13 +2,16 @@ package {{package}} {{#imports}}import {{import}} {{/imports}} +{{#reactive}} +import kotlinx.coroutines.flow.Flow; +{{/reactive}} import org.springframework.stereotype.Service @Service {{#operations}} class {{classname}}ServiceImpl : {{classname}}Service { {{#operation}} - override fun {{operationId}}({{#allParams}}{{paramName}}: {{>optionalDataType}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { + override {{#reactive}}{{^isListContainer}}suspend {{/isListContainer}}{{/reactive}}fun {{operationId}}({{#allParams}}{{paramName}}: {{^isBodyParam}}{{>optionalDataType}}{{/isBodyParam}}{{#isBodyParam}}{{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}{{>optionalDataType}}{{/isListContainer}}{{#isListContainer}}Flow<{{{baseType}}}>{{/isListContainer}}{{/reactive}}{{/isBodyParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}): {{>returnTypes}} { TODO("Implement me") } {{/operation}} diff --git a/modules/openapi-generator/src/main/resources/perl/ApiClient.mustache b/modules/openapi-generator/src/main/resources/perl/ApiClient.mustache index a65c20dac53..8175c47d623 100644 --- a/modules/openapi-generator/src/main/resources/perl/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/perl/ApiClient.mustache @@ -340,9 +340,17 @@ sub update_params_for_auth { {{/isKeyInQuery}} {{/isApiKey}} {{#isBasic}} + {{^isBasicBearer}} if ($self->{config}{username} || $self->{config}{password}) { $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); } + {{/isBasicBearer}} + {{#isBasicBearer}} + // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) + if ($self->{config}{access_token}) { + $headers['Authorization'] = 'Bearer ' . $self->{config}{access_token}; + } + {{/isBasicBearer}} {{/isBasic}} {{#isOAuth}} if ($self->{config}{access_token}) { diff --git a/modules/openapi-generator/src/main/resources/perl/api_doc.mustache b/modules/openapi-generator/src/main/resources/perl/api_doc.mustache index 99d5ad5198c..bcbc7b41345 100644 --- a/modules/openapi-generator/src/main/resources/perl/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/perl/api_doc.mustache @@ -29,8 +29,15 @@ use {{moduleName}}::{{classname}}; my $api_instance = {{moduleName}}::{{classname}}->new( {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} # Configure HTTP basic authorization: {{{name}}} + {{^isBasicBearer}} username => 'YOUR_USERNAME', - password => 'YOUR_PASSWORD',{{/isBasic}}{{#isApiKey}} + password => 'YOUR_PASSWORD', + {{/isBasicBearer}} + {{#isBasicBearer}} + # Configure bearer access token for authorization: {{{name}}} + access_token => 'YOUR_BEARER_TOKEN', + {{/isBasicBearer}} + {{/isBasic}}{{#isApiKey}} # Configure API key authorization: {{{name}}} api_key => {'{{{keyParamName}}}' => 'YOUR_API_KEY'}, # uncomment below to setup prefix (e.g. Bearer) for API key, if needed diff --git a/modules/openapi-generator/src/main/resources/perl/travis.mustache b/modules/openapi-generator/src/main/resources/perl/travis.mustache new file mode 100644 index 00000000000..cdfebb90fbe --- /dev/null +++ b/modules/openapi-generator/src/main/resources/perl/travis.mustache @@ -0,0 +1,9 @@ +# https://docs.travis-ci.com/user/languages/perl/ +# + +language: perl + +perl: + - "5.28" + +sudo: false diff --git a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache index 36b061f8f49..4585f1c6ad5 100644 --- a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache @@ -38,8 +38,11 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=4): + def __init__(self, configuration, pools_size=4, maxsize=None): + # maxsize is number of requests to host that are allowed in parallel + if maxsize is None: + maxsize = configuration.connection_pool_maxsize # ca_certs if configuration.ssl_ca_cert: diff --git a/modules/openapi-generator/src/main/resources/python/configuration.mustache b/modules/openapi-generator/src/main/resources/python/configuration.mustache index b6c134aa1c4..6d0d5c62e1c 100644 --- a/modules/openapi-generator/src/main/resources/python/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/python/configuration.mustache @@ -6,7 +6,9 @@ from __future__ import absolute_import import copy import logging +{{^asyncio}} import multiprocessing +{{/asyncio}} import sys import urllib3 @@ -116,6 +118,13 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): """Set this to True/False to enable/disable SSL hostname verification. """ + {{#asyncio}} + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. + """ + {{/asyncio}} + {{^asyncio}} self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 """urllib3 connection pool's maximum number of connections saved per pool. urllib3 uses 1 connection as default value, but this is @@ -123,6 +132,7 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): requests to the same host, which is often the case here. cpu_count * 5 is used as default value to increase performance. """ + {{/asyncio}} self.proxy = None """Proxy URL diff --git a/modules/openapi-generator/src/main/resources/r/api.mustache b/modules/openapi-generator/src/main/resources/r/api.mustache index 2612d6c838e..b56c7827999 100644 --- a/modules/openapi-generator/src/main/resources/r/api.mustache +++ b/modules/openapi-generator/src/main/resources/r/api.mustache @@ -33,6 +33,18 @@ }, {{#operation}} {{{operationId}}} = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}}={{^defaultValue}}NULL{{/defaultValue}}{{#defaultValue}}{{{.}}}{{/defaultValue}}, {{/optionalParams}}...){ + apiResponse <- self${{{operationId}}}WithHttpInfo({{#allParams}}{{paramName}}, {{/allParams}}...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + {{{operationId}}}WithHttpInfo = function({{#requiredParams}}{{paramName}}, {{/requiredParams}}{{#optionalParams}}{{paramName}}={{^defaultValue}}NULL{{/defaultValue}}{{#defaultValue}}{{{.}}}{{/defaultValue}}, {{/optionalParams}}...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -67,7 +79,13 @@ {{#hasBodyParam}} {{#bodyParams}} if (!missing(`{{paramName}}`)) { + {{#isListContainer}} + body.items = paste(unlist(lapply({{paramName}}, function(param){param$toJSONString()})), collapse = ",") + body <- paste0('[', body.items, ']') + {{/isListContainer}} + {{^isListContainer}} body <- `{{paramName}}`$toJSONString() + {{/isListContainer}} } else { body <- NULL } @@ -119,21 +137,23 @@ if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { {{#returnType}} {{#isPrimitiveType}} - httr::content(resp, "text", encoding = "UTF-8" + content <- httr::content(resp, "text", encoding = "UTF-8") + ApiResponse$new(content,resp) {{/isPrimitiveType}} {{^isPrimitiveType}} - {{returnType}}$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "{{returnType}}", "package:{{packageName}}") + ApiResponse$new(deserializedRespObj, resp) {{/isPrimitiveType}} {{/returnType}} {{^returnType}} - # void response, no need to return anything + {{! Returning the ApiResponse object with NULL object when the endpoint doesn't return anything}} + ApiResponse$new(NULL, resp) {{/returnType}} } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }{{#hasMore}},{{/hasMore}} {{/operation}} ) diff --git a/modules/openapi-generator/src/main/resources/r/api_client.mustache b/modules/openapi-generator/src/main/resources/r/api_client.mustache index 80510b10e8b..4a7e01b588a 100644 --- a/modules/openapi-generator/src/main/resources/r/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/r/api_client.mustache @@ -38,8 +38,10 @@ ApiClient <- R6::R6Class( apiKeys = NULL, # Access token accessToken = NULL, + # Time Out (seconds) + timeout = NULL, # constructor - initialize = function(basePath=NULL, userAgent=NULL, defaultHeaders=NULL, username=NULL, password=NULL, apiKeys=NULL, accessToken=NULL){ + initialize = function(basePath=NULL, userAgent=NULL, defaultHeaders=NULL, username=NULL, password=NULL, apiKeys=NULL, accessToken=NULL, timeout=NULL){ if (!is.null(basePath)) { self$basePath <- basePath } @@ -69,25 +71,77 @@ ApiClient <- R6::R6Class( if (!is.null(userAgent)) { self$`userAgent` <- userAgent } + + if (!is.null(timeout)) { + self$timeout <- timeout + } }, CallApi = function(url, method, queryParams, headerParams, body, ...){ headers <- httr::add_headers(c(headerParams, self$defaultHeaders)) + {{! Adding timeout that can be set at the apiClient object level}} + httpTimeout <- NULL + if (!is.null(self$timeout)) { + httpTimeout <- httr::timeout(self$timeout) + } + if (method == "GET") { - httr::GET(url, queryParams, headers, ...) + httr::GET(url, query = queryParams, headers, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "POST") { - httr::POST(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::POST(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "PUT") { - httr::PUT(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::PUT(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "PATCH") { - httr::PATCH(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::PATCH(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "HEAD") { - httr::HEAD(url, query = queryParams, headers, ...) + httr::HEAD(url, query = queryParams, headers, httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "DELETE") { - httr::DELETE(url, query = queryParams, headers, ...) + httr::DELETE(url, query = queryParams, headers, httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else { stop("http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.") } + }, + + deserialize = function(resp, returnType, pkgEnv) { + respObj <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8")) + self$deserializeObj(respObj, returnType, pkgEnv) + }, + + deserializeObj = function(obj, returnType, pkgEnv) { + returnObj <- NULL + primitiveTypes <- c("character", "numeric", "integer", "logical", "complex") + + if (startsWith(returnType, "map(")) { + innerReturnType <- regmatches(returnType, regexec(pattern = "map\\((.*)\\)", returnType))[[1]][2] + returnObj <- lapply(names(obj), function(name) { + self$deserializeObj(obj[[name]], innerReturnType, pkgEnv) + }) + names(returnObj) <- names(obj) + } else if (startsWith(returnType, "array[")) { + innerReturnType <- regmatches(returnType, regexec(pattern = "array\\[(.*)\\]", returnType))[[1]][2] + if (c(innerReturnType) %in% primitiveTypes) { + returnObj <- vector("list", length = length(obj)) + if (length(obj) > 0) { + for (row in 1:length(obj)) { + returnObj[[row]] <- self$deserializeObj(obj[row], innerReturnType, pkgEnv) + } + } + } else { + returnObj <- vector("list", length = nrow(obj)) + if (nrow(obj) > 0) { + for (row in 1:nrow(obj)) { + returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv) + } + } + } + } else if (exists(returnType, pkgEnv) && !(c(returnType) %in% primitiveTypes)) { + returnType <- get(returnType, envir = as.environment(pkgEnv)) + returnObj <- returnType$new() + returnObj$fromJSON(jsonlite::toJSON(obj, digits = NA)) + } else { + returnObj <- obj + } + returnObj } ) ) diff --git a/modules/openapi-generator/src/main/resources/r/model.mustache b/modules/openapi-generator/src/main/resources/r/model.mustache index 9c41f3a034c..6559ef18067 100644 --- a/modules/openapi-generator/src/main/resources/r/model.mustache +++ b/modules/openapi-generator/src/main/resources/r/model.mustache @@ -132,99 +132,79 @@ {{classname}}Object <- jsonlite::fromJSON({{classname}}Json) {{#vars}} if (!is.null({{classname}}Object$`{{baseName}}`)) { - {{#isListContainer}} - {{#isPrimitiveType}} - self$`{{baseName}}` <- {{classname}}Object$`{{baseName}}` - {{/isPrimitiveType}} - {{^isPrimitiveType}} - self$`{{baseName}}` <- sapply({{classname}}Object$`{{baseName}}`, function(x) { - {{baseName}}Object <- {{dataType}}$new() - {{baseName}}Object$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)) - {{baseName}}Object - }) - {{/isPrimitiveType}} - {{/isListContainer}} - {{^isListContainer}} + {{#isContainer}} + self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}", "package:{{packageName}}") + {{/isContainer}} + {{^isContainer}} {{#isPrimitiveType}} self$`{{baseName}}` <- {{classname}}Object$`{{baseName}}` {{/isPrimitiveType}} {{^isPrimitiveType}} {{baseName}}Object <- {{dataType}}$new() - {{baseName}}Object$fromJSON(jsonlite::toJSON({{classname}}Object${{baseName}}, auto_unbox = TRUE)) + {{baseName}}Object$fromJSON(jsonlite::toJSON({{classname}}Object${{baseName}}, auto_unbox = TRUE, digits = NA)) self$`{{baseName}}` <- {{baseName}}Object {{/isPrimitiveType}} - {{/isListContainer}} + {{/isContainer}} } {{/vars}} }, toJSONString = function() { - sprintf( - '{ - {{#vars}} - "{{baseName}}": - {{#isListContainer}} - {{#isPrimitiveType}} - {{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}}{{#hasMore}},{{/hasMore}} - {{/isPrimitiveType}} - {{^isPrimitiveType}} - [%s]{{#hasMore}},{{/hasMore}} - {{/isPrimitiveType}} - {{/isListContainer}} - {{^isListContainer}} - {{#isPrimitiveType}} - {{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}"%s"{{/isNumeric}}{{#hasMore}},{{/hasMore}} - {{/isPrimitiveType}} - {{^isPrimitiveType}} - %s{{#hasMore}},{{/hasMore}} - {{/isPrimitiveType}} - {{/isListContainer}} - {{/vars}} - }', - {{#vars}} + jsoncontent <- c( + {{#vars}} + if (!is.null(self$`{{baseName}}`)) { + sprintf( + '"{{baseName}}": {{#isListContainer}} {{#isPrimitiveType}} - paste(unlist(lapply(self$`{{{baseName}}}`, function(x) paste0('"', x, '"'))), collapse=","){{#hasMore}},{{/hasMore}} + {{#isNumeric}}[%d]{{/isNumeric}}{{^isNumeric}}[%s]{{/isNumeric}} {{/isPrimitiveType}} - {{^isPrimitiveType}} - paste(unlist(lapply(self$`{{{baseName}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE))), collapse=","){{#hasMore}},{{/hasMore}} + {{^isPrimitiveType}}[%s] {{/isPrimitiveType}} {{/isListContainer}} {{^isListContainer}} {{#isPrimitiveType}} - self$`{{baseName}}`{{#hasMore}},{{/hasMore}} + {{#isNumeric}}%d{{/isNumeric}}{{^isNumeric}}"%s"{{/isNumeric}} + {{/isPrimitiveType}} + {{^isPrimitiveType}}%s + {{/isPrimitiveType}} + {{/isListContainer}}', + {{#isListContainer}} + {{#isPrimitiveType}} + paste(unlist(lapply(self$`{{{baseName}}}`, function(x) paste0('"', x, '"'))), collapse=",") {{/isPrimitiveType}} {{^isPrimitiveType}} - jsonlite::toJSON(self$`{{baseName}}`$toJSON(), auto_unbox=TRUE){{#hasMore}},{{/hasMore}} + paste(unlist(lapply(self$`{{{baseName}}}`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA))), collapse=",") {{/isPrimitiveType}} {{/isListContainer}} + {{^isListContainer}} + {{#isPrimitiveType}} + self$`{{baseName}}` + {{/isPrimitiveType}} + {{^isPrimitiveType}} + jsonlite::toJSON(self$`{{baseName}}`$toJSON(), auto_unbox=TRUE, digits = NA) + {{/isPrimitiveType}} + {{/isListContainer}} + )}{{#hasMore}},{{/hasMore}} {{/vars}} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function({{classname}}Json) { {{classname}}Object <- jsonlite::fromJSON({{classname}}Json) {{#vars}} - {{#isListContainer}} - {{#isPrimitiveType}} - self$`{{baseName}}` <- lapply({{classname}}Object$`{{baseName}}`, function (x) x) - {{/isPrimitiveType}} - {{^isPrimitiveType}} - data.frame <- {{classname}}Object$`{{baseName}}` - self$`{{baseName}}` <- vector("list", length = nrow(data.frame)) - for (row in 1:nrow(data.frame)) { - {{baseName}}.node <- {{dataType}}$new() - {{baseName}}.node$fromJSON(jsonlite::toJSON(data.frame[row,,drop = TRUE], auto_unbox = TRUE)) - self$`{{baseName}}`[[row]] <- {{baseName}}.node - } - {{/isPrimitiveType}} - {{/isListContainer}} - {{^isListContainer}} + {{! AAPI - added condition for handling container type of parameters, map and array}} + {{#isContainer}} + self$`{{baseName}}` <- ApiClient$new()$deserializeObj({{classname}}Object$`{{baseName}}`, "{{dataType}}","package:{{packageName}}") + {{/isContainer}} + {{^isContainer}} {{#isPrimitiveType}} self$`{{baseName}}` <- {{classname}}Object$`{{baseName}}` {{/isPrimitiveType}} {{^isPrimitiveType}} - self$`{{baseName}}` <- {{dataType}}$new()$fromJSON(jsonlite::toJSON({{classname}}Object${{baseName}}, auto_unbox = TRUE)) + self$`{{baseName}}` <- {{dataType}}$new()$fromJSON(jsonlite::toJSON({{classname}}Object${{baseName}}, auto_unbox = TRUE, digits = NA)) {{/isPrimitiveType}} - {{/isListContainer}} + {{/isContainer}} {{/vars}} self } diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache index c92659ff2b1..bebf2fcae86 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -2,7 +2,6 @@ {{> api_info}} =end -require 'uri' require 'cgi' module {{moduleName}} @@ -124,7 +123,7 @@ module {{moduleName}} {{/hasValidation}} {{/allParams}} # resource path - local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s)){{/pathParams}} + local_var_path = '{{{path}}}'{{#pathParams}}.sub('{' + '{{baseName}}' + '}', CGI.escape({{paramName}}.to_s){{^strictSpecBehavior}}.gsub('%2F', '/'){{/strictSpecBehavior}}){{/pathParams}} # query parameters query_params = opts[:query_params] || {} diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache index 8e5b92e9e00..28c76241620 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api_client.mustache @@ -7,7 +7,6 @@ require 'json' require 'logger' require 'tempfile' require 'typhoeus' -require 'uri' module {{moduleName}} class ApiClient @@ -256,7 +255,7 @@ module {{moduleName}} def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + @config.base_url + path end # Builds the HTTP request body diff --git a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache index 2f43306a3b9..3c0148fbd4d 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/configuration.mustache @@ -2,8 +2,6 @@ {{> api_info}} =end -require 'uri' - module {{moduleName}} class Configuration # Defines url scheme @@ -166,8 +164,7 @@ module {{moduleName}} end def base_url - url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') end # Gets API key (with prefix if set). diff --git a/modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache b/modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache index e9f19c082d9..0ef33ce5e32 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/rubocop.mustache @@ -46,7 +46,7 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true -Layout/FirstParameterIndentation: +Layout/IndentFirstArgument: Enabled: true # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. diff --git a/modules/openapi-generator/src/main/resources/rust/README.mustache b/modules/openapi-generator/src/main/resources/rust/README.mustache index 83f83acdc96..62aa006644d 100644 --- a/modules/openapi-generator/src/main/resources/rust/README.mustache +++ b/modules/openapi-generator/src/main/resources/rust/README.mustache @@ -20,10 +20,10 @@ For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) ## Installation -Put the package under your project folder and add the following in import: +Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`: ``` - "./{{{packageName}}}" + openapi = { path = "./generated" } ``` ## Documentation for API Endpoints @@ -40,69 +40,12 @@ Class | Method | HTTP request | Description {{#models}}{{#model}} - [{{{classname}}}]({{{modelDocPath}}}{{{classname}}}.md) {{/model}}{{/models}} -## Documentation For Authorization - -{{^authMethods}} Endpoints do not require authorization. -{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} -{{#authMethods}} - -## {{{name}}} - -{{#isApiKey}}- **Type**: API key - -Example -``` - auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. - }) - r, err := client.Service.Operation(auth, args) -``` -{{/isApiKey}} -{{#isBasic}}- **Type**: HTTP basic authentication - -Example +To get access to the crate's generated documentation, use: ``` - auth := context.WithValue(context.TODO(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", - }) - r, err := client.Service.Operation(auth, args) +cargo doc --open ``` -{{/isBasic}} -{{#isOAuth}} - -- **Type**: OAuth -- **Flow**: {{{flow}}} -- **Authorization URL**: {{{authorizationUrl}}} -- **Scopes**: {{^scopes}}N/A{{/scopes}} -{{#scopes}} - **{{{scope}}}**: {{{description}}} -{{/scopes}} - -Example - -``` - auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING") - r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. - -``` - import "golang.org/x/oauth2" - - / .. Perform OAuth2 round trip request and obtain a token .. // - - tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) - auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) - r, err := client.Service.Operation(auth, args) -``` - -{{/isOAuth}} -{{/authMethods}} - ## Author {{#apiInfo}}{{#apis}}{{^hasMore}}{{{infoEmail}}} diff --git a/modules/openapi-generator/src/main/resources/rust/model.mustache b/modules/openapi-generator/src/main/resources/rust/model.mustache index ba7d821a117..4c6b8dff10c 100644 --- a/modules/openapi-generator/src/main/resources/rust/model.mustache +++ b/modules/openapi-generator/src/main/resources/rust/model.mustache @@ -8,13 +8,28 @@ #[allow(unused_imports)] use serde_json::Value; +{{!-- for enum schemas --}} +{{#isEnum}} +/// {{{description}}} +#[derive(Debug, Serialize, Deserialize)] +pub enum {{classname}} { +{{#allowableValues}} +{{#enumVars}} + #[serde(rename = "{{{value}}}")] + {{name}}, +{{/enumVars}}{{/allowableValues}} +} +{{/isEnum}} + +{{!-- for non-enum schemas --}} +{{^isEnum}} #[derive(Debug, Serialize, Deserialize)] pub struct {{{classname}}} { {{#vars}} {{#description}} /// {{{description}}} {{/description}} - #[serde(rename = "{{{baseName}}}")] + #[serde(rename = "{{{baseName}}}"{{^required}}, skip_serializing_if = "Option::is_none"{{/required}})] pub {{{name}}}: {{#required}}{{#isNullable}}Option<{{/isNullable}}{{/required}}{{^required}}Option<{{/required}}{{{dataType}}}{{#required}}{{#isNullable}}>{{/isNullable}}{{/required}}{{^required}}>{{/required}}, {{/vars}} } @@ -31,16 +46,23 @@ impl {{{classname}}} { } } } -{{#isEnum}} -// TODO enum -// List of {{{name}}} -//const ( -// {{#allowableValues}} -// {{#enumVars}} -// {{{name}}} {{{classname}}} = "{{{value}}}" -// {{/enumVars}} -// {{/allowableValues}} -//) {{/isEnum}} + +{{!-- for properties that are of enum type --}} +{{#vars}} +{{#isEnum}} +/// {{{description}}} +#[derive(Debug, Serialize, Deserialize)] +pub enum {{enumName}} { +{{#allowableValues}} +{{#enumVars}} + #[serde(rename = "{{{value}}}")] + {{name}}, +{{/enumVars}} +{{/allowableValues}} +} +{{/isEnum}} +{{/vars}} + {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache index 80c30e7dcb6..318b0f7a0db 100644 --- a/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache +++ b/modules/openapi-generator/src/main/resources/rust/reqwest/api_mod.mustache @@ -10,19 +10,19 @@ pub enum Error { impl From for Error { fn from(e: reqwest::Error) -> Self { - return Error::Reqwest(e) + Error::Reqwest(e) } } impl From for Error { fn from(e: serde_json::Error) -> Self { - return Error::Serde(e) + Error::Serde(e) } } impl From for Error { fn from(e: std::io::Error) -> Self { - return Error::Io(e) + Error::Io(e) } } diff --git a/modules/openapi-generator/src/main/resources/scala-play-server/app/apiDocController.scala.mustache b/modules/openapi-generator/src/main/resources/scala-play-server/app/apiDocController.scala.mustache index d6a85a65963..b2d81f06027 100644 --- a/modules/openapi-generator/src/main/resources/scala-play-server/app/apiDocController.scala.mustache +++ b/modules/openapi-generator/src/main/resources/scala-play-server/app/apiDocController.scala.mustache @@ -6,6 +6,6 @@ import play.api.mvc._ @Singleton class ApiDocController @Inject()(cc: ControllerComponents) extends AbstractController(cc) { def api: Action[AnyContent] = Action { - Redirect("/assets/lib/swagger-ui/index.html?/url=/assets/openapi.json") + Redirect("/assets/lib/swagger-ui/index.html?url=/assets/openapi.json") } } diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache index 6a1967c7c86..976fce56236 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/apis.mustache @@ -107,10 +107,21 @@ export class {{classname}} extends runtime.BaseAPI { {{/headerParams}} {{#authMethods}} {{#isBasic}} + {{#isBasicBasic}} if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } + {{/isBasicBasic}} + {{#isBasicBearer}} + if (this.configuration && (this.configuration.accessToken || this.configuration.apiKey)) { + const token = this.configuration.accessToken || this.configuration.apiKey; + const tokenString = typeof token === 'function' ? token("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) : token; + if (tokenString) { + headerParameters["Authorization"] = `Bearer ${tokenString}`; + } + } + {{/isBasicBearer}} {{/isBasic}} {{#isApiKey}} {{#isKeyInHeader}} diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache index c394a87f283..fe486821daf 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/apis.mustache @@ -1,7 +1,7 @@ // tslint:disable {{>licenseInfo}} import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; {{#imports.0}} import { {{#imports}} @@ -37,105 +37,83 @@ export class {{classname}} extends BaseAPI { * {{&summary}} {{/summary}} */ - {{nickname}}({{#allParams.0}}requestParameters: {{operationIdCamelCase}}Request{{/allParams.0}}): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> { + {{nickname}} = ({{#allParams.0}}requestParameters: {{operationIdCamelCase}}Request{{/allParams.0}}): Observable<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> => { {{#allParams}} {{#required}} - if (requestParameters.{{paramName}} === null || requestParameters.{{paramName}} === undefined) { - throw new RequiredError('{{paramName}}','Required parameter requestParameters.{{paramName}} was null or undefined when calling {{nickname}}.'); - } - + throwIfRequired(requestParameters, '{{paramName}}', '{{nickname}}'); {{/required}} {{/allParams}} - const queryParameters: HttpQuery = {}; - {{#queryParams}} - {{#isListContainer}} - if (requestParameters.{{paramName}}) { + const headers: HttpHeaders = { + {{#bodyParam}} + {{^consumes}} + 'Content-Type': 'application/json', + {{/consumes}} + {{#consumes.0}} + 'Content-Type': '{{{mediaType}}}', + {{/consumes.0}} + {{/bodyParam}} + {{#headerParams}} + {{#isListContainer}} + ...(requestParameters.{{paramName}} && { '{{baseName}}': requestParameters.{{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])) }), + {{/isListContainer}} + {{^isListContainer}} + ...(requestParameters.{{paramName}} && { '{{baseName}}': String(requestParameters.{{paramName}}) }), + {{/isListContainer}} + {{/headerParams}} + {{#authMethods}} + {{#isBasic}} + ...(this.configuration.username && this.configuration.password && { Authorization: `Basic ${btoa(this.configuration.username + ':' + this.configuration.password)}` }), + {{/isBasic}} + {{#isApiKey}} + {{#isKeyInHeader}} + ...(this.configuration.apiKey && { '{{keyParamName}}': this.configuration.apiKey('{{keyParamName}}') }), // {{name}} authentication + {{/isKeyInHeader}} + {{/isApiKey}} + {{#isOAuth}} + // oauth required + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('{{name}}', [{{#scopes}}'{{{scope}}}'{{^-last}}, {{/-last}}{{/scopes}}]) + : this.configuration.accessToken) + }), + {{/isOAuth}} + {{/authMethods}} + }; + + const query: HttpQuery = { + {{#queryParams}} + {{#isListContainer}} {{#isCollectionFormatMulti}} - queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; + ...(requestParameters.{{paramName}} && { '{{baseName}}': requestParameters.{{paramName}} }), {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - queryParameters['{{baseName}}'] = requestParameters.{{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + ...(requestParameters.{{paramName}} && { '{{baseName}}': requestParameters.{{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']) }), {{/isCollectionFormatMulti}} - } - - {{/isListContainer}} - {{^isListContainer}} - if (requestParameters.{{paramName}} !== undefined && requestParameters.{{paramName}} !== null) { + {{/isListContainer}} + {{^isListContainer}} {{#isDateTime}} - queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString(); + ...(requestParameters.{{paramName}} && { '{{baseName}}': (requestParameters.{{paramName}} as any).toISOString() }), {{/isDateTime}} {{^isDateTime}} {{#isDate}} - queryParameters['{{baseName}}'] = (requestParameters.{{paramName}} as any).toISOString(); + ...(requestParameters.{{paramName}} && { '{{baseName}}': (requestParameters.{{paramName}} as any).toISOString() }), {{/isDate}} {{^isDate}} - queryParameters['{{baseName}}'] = requestParameters.{{paramName}}; + ...(requestParameters.{{paramName}} && { '{{baseName}}': requestParameters.{{paramName}} }), {{/isDate}} {{/isDateTime}} - } + {{/isListContainer}} + {{/queryParams}} + {{#authMethods}} + {{#isApiKey}} + {{#isKeyInQuery}} + ...(this.configuration.apiKey && { '{{keyParamName}}': this.configuration.apiKey && this.configuration.apiKey('{{keyParamName}}') }), // {{name}} authentication + {{/isKeyInQuery}} + {{/isApiKey}} + {{/authMethods}} + }; - {{/isListContainer}} - {{/queryParams}} - const headerParameters: HttpHeaders = {}; - - {{#bodyParam}} - {{^consumes}} - headerParameters['Content-Type'] = 'application/json'; - - {{/consumes}} - {{#consumes.0}} - headerParameters['Content-Type'] = '{{{mediaType}}}'; - - {{/consumes.0}} - {{/bodyParam}} - {{#headerParams}} - {{#isListContainer}} - if (requestParameters.{{paramName}}) { - headerParameters['{{baseName}}'] = requestParameters.{{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); - } - - {{/isListContainer}} - {{^isListContainer}} - if (requestParameters.{{paramName}} !== undefined && requestParameters.{{paramName}} !== null) { - headerParameters['{{baseName}}'] = String(requestParameters.{{paramName}}); - } - - {{/isListContainer}} - {{/headerParams}} - {{#authMethods}} - {{#isBasic}} - if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { - headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); - } - - {{/isBasic}} - {{#isApiKey}} - {{#isKeyInHeader}} - if (this.configuration && this.configuration.apiKey) { - headerParameters["{{keyParamName}}"] = this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication - } - - {{/isKeyInHeader}} - {{#isKeyInQuery}} - if (this.configuration && this.configuration.apiKey) { - queryParameters["{{keyParamName}}"] = this.configuration.apiKey("{{keyParamName}}"); // {{name}} authentication - } - - {{/isKeyInQuery}} - {{/isApiKey}} - {{#isOAuth}} - if (this.configuration && this.configuration.accessToken) { - // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } - - {{/isOAuth}} - {{/authMethods}} {{#hasFormParams}} const formData = new FormData(); {{/hasFormParams}} @@ -148,7 +126,7 @@ export class {{classname}} extends BaseAPI { }) {{/isCollectionFormatMulti}} {{^isCollectionFormatMulti}} - formData.append('{{baseName}}', requestParameters.{{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); + formData.append('{{baseName}}', requestParameters.{{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])); {{/isCollectionFormatMulti}} } @@ -161,10 +139,10 @@ export class {{classname}} extends BaseAPI { {{/isListContainer}} {{/formParams}} return this.request<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}>({ - path: `{{{path}}}`{{#pathParams}}.replace(`{${"{{baseName}}"}}`, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}}, + path: `{{{path}}}`{{#pathParams}}.replace({{=<% %>=}}`{<%baseName%>}`<%={{ }}=%>, encodeURIComponent(String(requestParameters.{{paramName}}))){{/pathParams}}, method: '{{httpMethod}}', - headers: headerParameters, - query: queryParameters, + headers, + query, {{#hasBodyParam}} {{#bodyParam}} {{#isContainer}} @@ -196,9 +174,9 @@ export class {{classname}} extends BaseAPI { {{#allParams}} {{#isEnum}} /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum {{operationIdCamelCase}}{{enumName}} { {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache index a3644702312..19f893b62d3 100644 --- a/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-rxjs/runtime.mustache @@ -55,30 +55,26 @@ export class Configuration { * This is the base class for all generated API classes. */ export class BaseAPI { - private middleware: Middleware[]; + private middleware: Middleware[] = []; constructor(protected configuration = new Configuration()) { this.middleware = configuration.middleware; } - withMiddleware(this: T, ...middlewares: Middleware[]) { + withMiddleware = (middlewares: Middleware[]) => { const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); + next.middleware = next.middleware.concat(middlewares); return next; } - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } + withPreMiddleware = (preMiddlewares: Array) => + this.withMiddleware(preMiddlewares.map((pre) => ({ pre }))); - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } + withPostMiddleware = (postMiddlewares: Array) => + this.withMiddleware(postMiddlewares.map((post) => ({ post }))); - protected request(context: RequestOpts): Observable { - return this.rxjsRequest(this.createRequestArgs(context)).pipe( + protected request = (context: RequestOpts): Observable => + this.rxjsRequest(this.createRequestArgs(context)).pipe( map((res) => { if (res.status >= 200 && res.status < 300) { return res.response as T; @@ -86,15 +82,14 @@ export class BaseAPI { throw res; }) ); - } - private createRequestArgs(context: RequestOpts): RequestArgs { + private createRequestArgs = (context: RequestOpts): RequestArgs => { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. + // only add the queryString to the URL if there are query parameters. // this is done to avoid urls ending with a '?' character which buggy webservers // do not handle correctly sometimes. - url += '?' + querystring(context.query); + url += '?' + queryString(context.query); } const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body); const options = { @@ -105,9 +100,9 @@ export class BaseAPI { return { url, options }; } - private rxjsRequest(params: RequestContext): Observable { - const preMiddlewares = this.middleware && this.middleware.filter((item) => item.pre); - const postMiddlewares = this.middleware && this.middleware.filter((item) => item.post); + private rxjsRequest = (params: RequestContext): Observable => { + const preMiddlewares = this.middleware.filter((item) => item.pre); + const postMiddlewares = this.middleware.filter((item) => item.post); return of(params).pipe( map((args) => { @@ -133,19 +128,13 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } + private clone = (): T => + Object.assign(Object.create(Object.getPrototypeOf(this)), this) } +// export for not being a breaking change export class RequiredError extends Error { name: 'RequiredError' = 'RequiredError'; - constructor(public field: string, msg?: string) { - super(msg); - } } export const COLLECTION_FORMATS = { @@ -175,17 +164,24 @@ export interface RequestOpts { body?: HttpBody; } -export function querystring(params: HttpQuery): string { - return Object.keys(params) - .map((key) => { - const value = params[key]; - if (value instanceof Array) { - return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) - .join('&'); - } - return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; - }) - .join('&'); +const queryString = (params: HttpQuery): string => Object.keys(params) + .map((key) => { + const value = params[key]; + if (value instanceof Array) { + return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) + .join('&'); + } + return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; + }) + .join('&'); + +// alias fallback for not being a breaking change +export const querystring = queryString; + +export const throwIfRequired = (params: {[key: string]: any}, key: string, nickname: string) => { + if (!params || params[key] === null || params[key] === undefined) { + throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`); + } } export interface RequestContext extends RequestArgs {} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java index 518f6fee879..fc9b05521c4 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/AbstractIntegrationTest.java @@ -58,13 +58,12 @@ public abstract class AbstractIntegrationTest { CodegenConfig codegenConfig = getCodegenConfig(); codegenConfig.setOutputDir(integrationTestPathsConfig.getOutputPath().toString()); codegenConfig.setIgnoreFilePathOverride(integrationTestPathsConfig.getIgnoreFilePath().toFile().toString()); - ClientOpts clientOpts = new ClientOpts(); - clientOpts.setProperties(configProperties()); ClientOptInput opts = new ClientOptInput() .config(codegenConfig) - .opts(clientOpts) .openAPI(openAPI); + codegenConfig.additionalProperties().putAll(configProperties()); + codeGen.opts(opts).generate(); assertPathEqualsRecursively(integrationTestPathsConfig.getExpectedPath(), integrationTestPathsConfig.getOutputPath()); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java index fe708c0ed66..b8b3a717905 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultCodegenTest.java @@ -17,6 +17,8 @@ package org.openapitools.codegen; +import com.google.common.collect.Sets; +import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; @@ -27,10 +29,15 @@ import io.swagger.v3.oas.models.parameters.QueryParameter; import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.oas.models.responses.ApiResponses; +import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.languages.features.CXFServerFeatures; import org.openapitools.codegen.utils.ModelUtils; import org.testng.Assert; import org.testng.annotations.Test; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; import java.util.*; import java.util.stream.Collectors; @@ -622,4 +629,79 @@ public class DefaultCodegenTest { Map objs = Collections.singletonMap("models", Collections.singletonList(Collections.singletonMap("model", cm))); return objs; } + + @Test + public void objectQueryParamIdentifyAsObject() { + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/3_0/objectQueryParam.yaml"); + new InlineModelResolver().flatten(openAPI); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + Set imports = new HashSet<>(); + CodegenParameter parameter = codegen.fromParameter(openAPI.getPaths().get("/pony").getGet().getParameters().get(0), imports); + + Assert.assertEquals(parameter.dataType, "PageQuery"); + Assert.assertEquals(imports.size(), 1); + Assert.assertEquals(imports.iterator().next(), "PageQuery"); + } + + @Test + public void mapParamImportInnerObject() { + final OpenAPI openAPI = TestUtils.parseSpec("src/test/resources/2_0/mapArgs.yaml"); + final DefaultCodegen codegen = new DefaultCodegen(); + codegen.setOpenAPI(openAPI); + + RequestBody requestBody = openAPI.getPaths().get("/api/instruments").getPost().getRequestBody(); + + HashSet imports = new HashSet<>(); + codegen.fromRequestBody(requestBody, imports, ""); + + HashSet expected = Sets.newHashSet("InstrumentDefinition", "map"); + + Assert.assertEquals(imports, expected); + } + + @Test + public void modelDoNotContainInheritedVars() { + DefaultCodegen codegen = new DefaultCodegen(); + codegen.supportsInheritance = true; + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + codegen.setOpenAPI(openAPI); + + CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); + + Assert.assertEquals(codegenModel.vars.size(), 1); + } + + @Test + public void modelWithPrefixDoNotContainInheritedVars() { + DefaultCodegen codegen = new DefaultCodegen(); + codegen.supportsInheritance = true; + codegen.setModelNamePrefix("prefix"); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + codegen.setOpenAPI(openAPI); + + CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); + + Assert.assertEquals(codegenModel.vars.size(), 1); + } + @Test + public void modelWithSuffixDoNotContainInheritedVars() { + DefaultCodegen codegen = new DefaultCodegen(); + codegen.supportsInheritance = true; + codegen.setModelNameSuffix("suffix"); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); + codegen.setOpenAPI(openAPI); + + CodegenModel codegenModel = codegen.fromModel("Dog", openAPI.getComponents().getSchemas().get("Dog")); + + Assert.assertEquals(codegenModel.vars.size(), 1); + } + } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java index 89ebd814187..e8097915a0f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/DefaultGeneratorTest.java @@ -31,7 +31,6 @@ public class DefaultGeneratorTest { ClientOptInput opts = new ClientOptInput(); opts.setOpenAPI(openAPI); opts.setConfig(new DefaultCodegen()); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); @@ -62,7 +61,6 @@ public class DefaultGeneratorTest { CodegenConfig config = new DefaultCodegen(); config.setStrictSpecBehavior(false); opts.setConfig(config); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); @@ -85,7 +83,6 @@ public class DefaultGeneratorTest { DefaultCodegen codegen = new DefaultCodegen(); codegen.setEnableMinimalUpdate(true); opts.setConfig(codegen); - opts.setOpts(new ClientOpts()); DefaultGenerator generator = new DefaultGenerator(); generator.opts(opts); File testPath = new File("temp/overwrite.test"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/TestUtils.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/TestUtils.java index 6536497b2a1..65614c7e51a 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/TestUtils.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/TestUtils.java @@ -1,5 +1,7 @@ package org.openapitools.codegen; +import static org.testng.Assert.assertTrue; + import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; @@ -8,12 +10,15 @@ import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.parser.core.models.ParseOptions; + import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile; import org.testng.Assert; import java.io.File; import java.util.Collections; +import java.util.Map; import java.util.Optional; +import java.util.stream.Collectors; public class TestUtils { @@ -55,4 +60,14 @@ public class TestUtils { Assert.assertTrue(optional.isPresent()); return optional.get(); } + + public static void ensureContainsFile(Map generatedFiles, File root, String filename) { + File file = new File(root, filename); + String absoluteFilename = file.getAbsolutePath().replace("\\", "/"); + if (!generatedFiles.containsKey(absoluteFilename)) { + Assert.fail("Could not find '" + absoluteFilename + "' file in list:\n" + + generatedFiles.keySet().stream().sorted().collect(Collectors.joining(",\n"))); + } + assertTrue(generatedFiles.containsKey(absoluteFilename), "File '" + absoluteFilename + "' was not fould in the list of generated files"); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java new file mode 100644 index 00000000000..062f906743f --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/config/DynamicSettingsTest.java @@ -0,0 +1,107 @@ +package org.openapitools.codegen.config; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.datatype.guava.GuavaModule; +import io.swagger.v3.core.util.Yaml; +import org.testng.annotations.Test; + +import java.io.File; + +import static org.testng.Assert.*; + +public class DynamicSettingsTest { + + @Test + public void tesDynamicSettingsWithDynamicProperties() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + String spec = + "gemName: 'petstore'" + System.lineSeparator() + + "moduleName: 'Petstore'" + System.lineSeparator() + + "gemVersion: '1.0.0'" + System.lineSeparator() + + "apiPackage: 'testing'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getApiPackage(), "testing"); + assertEquals(generatorSettings.getAdditionalProperties().size(), 7); + assertEquals(generatorSettings.getAdditionalProperties().get("gemName"), "petstore"); + assertEquals(generatorSettings.getAdditionalProperties().get("moduleName"), "Petstore"); + assertEquals(generatorSettings.getAdditionalProperties().get("gemVersion"), "1.0.0"); + assertEquals(generatorSettings.getAdditionalProperties().get("apiPackage"), "testing"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), "GIT_USER_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } + + @Test + public void testDynamicSettingsWithBuilderSideEffects() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + // example here is that templateDir is intended to provide the _full_ absolute path + String input = "."; + File current = new File(input); + + // sanity + assertTrue(current.exists()); + assertTrue(current.isDirectory()); + + String spec = + "generatorName: none" + System.lineSeparator() + + "templateDir: '" + input + "'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getGeneratorName(), "none"); + assertEquals(workflowSettings.getTemplateDir(), current.getAbsolutePath()); + assertNotEquals(workflowSettings.getTemplateDir(), input); + + assertEquals(generatorSettings.getAdditionalProperties().size(), 3); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), "GIT_USER_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } + + @Test + public void testDynamicSettingsSetsConstructorDefaultsOnDeserialization() throws Exception { + ObjectMapper mapper = Yaml.mapper(); + mapper.registerModule(new GuavaModule()); + + String gitUserId = "openapitools"; + String spec = + "supportPython2: true" + System.lineSeparator() + + "gitUserId: '" + gitUserId + "'" + System.lineSeparator(); + + DynamicSettings dynamicSettings = mapper.readValue(spec, DynamicSettings.class); + GeneratorSettings generatorSettings = dynamicSettings.getGeneratorSettings(); + WorkflowSettings workflowSettings = dynamicSettings.getWorkflowSettings(); + + assertNotNull(dynamicSettings); + assertNotNull(generatorSettings); + assertNotNull(workflowSettings); + + assertEquals(generatorSettings.getGitUserId(), gitUserId); + assertEquals(generatorSettings.getGitRepoId(), "GIT_REPO_ID"); + assertEquals(generatorSettings.getReleaseNote(), "Minor update"); + + assertEquals(generatorSettings.getAdditionalProperties().size(), 4); + assertEquals(generatorSettings.getAdditionalProperties().get("supportPython2"), true); + assertEquals(generatorSettings.getAdditionalProperties().get("gitUserId"), gitUserId); + assertEquals(generatorSettings.getAdditionalProperties().get("gitRepoId"), "GIT_REPO_ID"); + assertEquals(generatorSettings.getAdditionalProperties().get("releaseNote"), "Minor update"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java index 7bdf5afbb60..634fcc45506 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/go/GoClientOptionsTest.java @@ -52,6 +52,8 @@ public class GoClientOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setPrependFormOrBodyParameters(Boolean.valueOf(GoClientOptionsProvider.PREPEND_FORM_OR_BODY_PARAMETERS_VALUE)); times = 1; + clientCodegen.setIsGoSubmodule(Boolean.valueOf(GoClientOptionsProvider.IS_GO_SUBMODULE_VALUE)); + times = 1; }}; } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java index 68c556e5b09..faa146c07ff 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaClientCodegenTest.java @@ -17,15 +17,36 @@ package org.openapitools.codegen.java; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; + import com.google.common.collect.ImmutableMap; + import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; -import io.swagger.v3.oas.models.media.*; +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.ComposedSchema; +import io.swagger.v3.oas.models.media.Content; +import io.swagger.v3.oas.models.media.IntegerSchema; +import io.swagger.v3.oas.models.media.MediaType; +import io.swagger.v3.oas.models.media.ObjectSchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.oas.models.parameters.RequestBody; import io.swagger.v3.oas.models.responses.ApiResponse; import io.swagger.v3.parser.util.SchemaTypeUtil; -import org.openapitools.codegen.*; + +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenParameter; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.CodegenResponse; +import org.openapitools.codegen.DefaultGenerator; +import org.openapitools.codegen.MockDefaultGenerator; import org.openapitools.codegen.MockDefaultGenerator.WrittenTemplateBasedFile; +import org.openapitools.codegen.TestUtils; import org.openapitools.codegen.config.CodegenConfigurator; import org.openapitools.codegen.languages.JavaClientCodegen; import org.testng.Assert; @@ -33,12 +54,15 @@ import org.testng.annotations.Test; import java.io.File; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.stream.Collectors; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - public class JavaClientCodegenTest { @Test @@ -53,7 +77,7 @@ public class JavaClientCodegenTest { CodegenParameter codegenParameter1 = codegen.fromRequestBody(body1, new HashSet(), null); Assert.assertEquals(codegenParameter1.description, "A list of ids"); Assert.assertEquals(codegenParameter1.dataType, "List"); - Assert.assertEquals(codegenParameter1.baseType, "List"); + Assert.assertEquals(codegenParameter1.baseType, "String"); RequestBody body2 = new RequestBody(); body2.setDescription("A list of list of values"); @@ -73,7 +97,7 @@ public class JavaClientCodegenTest { CodegenParameter codegenParameter3 = codegen.fromRequestBody(body3, new HashSet(), null); Assert.assertEquals(codegenParameter3.description, "A list of points"); Assert.assertEquals(codegenParameter3.dataType, "List"); - Assert.assertEquals(codegenParameter3.baseType, "List"); + Assert.assertEquals(codegenParameter3.baseType, "Point"); } @Test @@ -257,42 +281,42 @@ public class JavaClientCodegenTest { Map generatedFiles = generator.getFiles(); Assert.assertEquals(generatedFiles.size(), 34); - ensureContainsFile(generatedFiles, output, ".gitignore"); - ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore"); - ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION"); - ensureContainsFile(generatedFiles, output, ".travis.yml"); - ensureContainsFile(generatedFiles, output, "build.gradle"); - ensureContainsFile(generatedFiles, output, "build.sbt"); - ensureContainsFile(generatedFiles, output, "docs/DefaultApi.md"); - ensureContainsFile(generatedFiles, output, "git_push.sh"); - ensureContainsFile(generatedFiles, output, "gradle.properties"); - ensureContainsFile(generatedFiles, output, "gradle/wrapper/gradle-wrapper.jar"); - ensureContainsFile(generatedFiles, output, "gradle/wrapper/gradle-wrapper.properties"); - ensureContainsFile(generatedFiles, output, "gradlew.bat"); - ensureContainsFile(generatedFiles, output, "gradlew"); - ensureContainsFile(generatedFiles, output, "pom.xml"); - ensureContainsFile(generatedFiles, output, "README.md"); - ensureContainsFile(generatedFiles, output, "settings.gradle"); - ensureContainsFile(generatedFiles, output, "src/main/AndroidManifest.xml"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/api/DefaultApi.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiCallback.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiClient.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiException.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiResponse.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/ApiKeyAuth.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/Authentication.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/HttpBasicAuth.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/HttpBearerAuth.java"); - //ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/OAuth.java"); - //ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/OAuthFlow.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/Configuration.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/GzipRequestInterceptor.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/JSON.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/Pair.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ProgressRequestBody.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ProgressResponseBody.java"); - ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/StringUtil.java"); - ensureContainsFile(generatedFiles, output, "src/test/java/xyz/abcdef/api/DefaultApiTest.java"); + TestUtils.ensureContainsFile(generatedFiles, output, ".gitignore"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION"); + TestUtils.ensureContainsFile(generatedFiles, output, ".travis.yml"); + TestUtils.ensureContainsFile(generatedFiles, output, "build.gradle"); + TestUtils.ensureContainsFile(generatedFiles, output, "build.sbt"); + TestUtils.ensureContainsFile(generatedFiles, output, "docs/DefaultApi.md"); + TestUtils.ensureContainsFile(generatedFiles, output, "git_push.sh"); + TestUtils.ensureContainsFile(generatedFiles, output, "gradle.properties"); + TestUtils.ensureContainsFile(generatedFiles, output, "gradle/wrapper/gradle-wrapper.jar"); + TestUtils.ensureContainsFile(generatedFiles, output, "gradle/wrapper/gradle-wrapper.properties"); + TestUtils.ensureContainsFile(generatedFiles, output, "gradlew.bat"); + TestUtils.ensureContainsFile(generatedFiles, output, "gradlew"); + TestUtils.ensureContainsFile(generatedFiles, output, "pom.xml"); + TestUtils.ensureContainsFile(generatedFiles, output, "README.md"); + TestUtils.ensureContainsFile(generatedFiles, output, "settings.gradle"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/AndroidManifest.xml"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/api/DefaultApi.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiCallback.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiClient.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiException.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ApiResponse.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/ApiKeyAuth.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/Authentication.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/HttpBasicAuth.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/HttpBearerAuth.java"); + //TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/OAuth.java"); + //TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/auth/OAuthFlow.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/Configuration.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/GzipRequestInterceptor.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/JSON.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/Pair.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ProgressRequestBody.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/ProgressResponseBody.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/main/java/xyz/abcdef/StringUtil.java"); + TestUtils.ensureContainsFile(generatedFiles, output, "src/test/java/xyz/abcdef/api/DefaultApiTest.java"); String defaultApiFilename = new File(output, "src/main/java/xyz/abcdef/api/DefaultApi.java").getAbsolutePath().replace("\\", "/"); String defaultApiConent = generatedFiles.get(defaultApiFilename); @@ -329,10 +353,6 @@ public class JavaClientCodegenTest { clientOptInput.setOpenAPI(openAPI); clientOptInput.setConfig(new JavaClientCodegen()); - final ClientOpts clientOpts = new ClientOpts(); - clientOpts.setProperties(Collections.emptyMap()); - clientOptInput.setOpts(clientOpts); - defaultGenerator.opts(clientOptInput); final List codegenOperations = defaultGenerator.processPaths(openAPI.getPaths()).get("Pet"); @@ -384,16 +404,6 @@ public class JavaClientCodegenTest { Assert.assertEquals(cm.getClassname(), "OtherObj"); } - private void ensureContainsFile(Map generatedFiles, File root, String filename) { - File file = new File(root, filename); - String absoluteFilename = file.getAbsolutePath().replace("\\", "/"); - if (!generatedFiles.containsKey(absoluteFilename)) { - Assert.fail("Could not find '" + absoluteFilename + "' file in list:\n" + - generatedFiles.keySet().stream().sorted().collect(Collectors.joining(",\n"))); - } - assertTrue(generatedFiles.containsKey(absoluteFilename), "File '" + absoluteFilename + "' was not fould in the list of generated files"); - } - private CodegenProperty codegenPropertyWithArrayOfIntegerValues() { CodegenProperty array = new CodegenProperty(); final CodegenProperty items = new CodegenProperty(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java index 339fc73c11b..29d39e5629b 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java @@ -1104,7 +1104,7 @@ public class JavaModelTest { .items(new Schema<>().$ref("#/components/schemas/Pet")); Operation operation = new Operation() .requestBody(new RequestBody() - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema)))) .responses( new ApiResponses().addApiResponse("204", new ApiResponse() @@ -1116,7 +1116,7 @@ public class JavaModelTest { Assert.assertEquals(co.bodyParams.size(), 1); CodegenParameter cp1 = co.bodyParams.get(0); - Assert.assertEquals(cp1.baseType, "List"); + Assert.assertEquals(cp1.baseType, "Pet"); Assert.assertEquals(cp1.dataType, "List"); Assert.assertTrue(cp1.isContainer); Assert.assertTrue(cp1.isListContainer); @@ -1138,7 +1138,7 @@ public class JavaModelTest { Operation operation = new Operation().responses( new ApiResponses().addApiResponse("200", new ApiResponse() .description("Ok response") - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema))))); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema())); final DefaultCodegen codegen = new JavaClientCodegen(); @@ -1184,7 +1184,7 @@ public class JavaModelTest { .items(new Schema<>().$ref("#/components/schemas/Pet"))); Operation operation = new Operation() .requestBody(new RequestBody() - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema)))) .responses( new ApiResponses().addApiResponse("204", new ApiResponse() @@ -1222,7 +1222,7 @@ public class JavaModelTest { Operation operation = new Operation().responses( new ApiResponses().addApiResponse("200", new ApiResponse() .description("Ok response") - .content(new Content().addMediaType("application/json", + .content(new Content().addMediaType("application/json", new MediaType().schema(testSchema))))); OpenAPI openAPI = TestUtils.createOpenAPIWithOneSchema("Pet", new ObjectSchema().addProperties("name", new StringSchema())); final DefaultCodegen codegen = new JavaClientCodegen(); @@ -1280,7 +1280,6 @@ public class JavaModelTest { final ClientOptInput opts = new ClientOptInput(); opts.setConfig(config); opts.setOpenAPI(openAPI); - opts.setOpts(new ClientOpts()); new DefaultGenerator().opts(opts).generate(); File orderFile = new File(output, "src/main/java/org/openapitools/client/api/DefaultApi.java"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java index 273229f6300..d8260487034 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJAXRSCXFExtServerCodegenTest.java @@ -369,11 +369,9 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest { .getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -448,13 +446,11 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest { .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); + codegen.additionalProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -494,14 +490,12 @@ public class JavaJAXRSCXFExtServerCodegenTest extends JavaJaxrsBaseTest { .readLocation("src/test/resources/3_0/petstore.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFExtServerFeatures.GENERATE_OPERATION_BODY, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java index e76f0bf6fe9..0b782aa3c4e 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJaxrsBaseTest.java @@ -5,7 +5,6 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.media.StringSchema; import io.swagger.v3.parser.core.models.ParseOptions; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.MockDefaultGenerator; import org.openapitools.codegen.languages.AbstractJavaJAXRSServerCodegen; import org.openapitools.codegen.languages.features.CXFServerFeatures; @@ -33,13 +32,11 @@ public abstract class JavaJaxrsBaseTest { .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -75,13 +72,11 @@ public abstract class JavaJaxrsBaseTest { .readLocation("src/test/resources/3_0/generic.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -112,13 +107,11 @@ public abstract class JavaJaxrsBaseTest { .readLocation("src/test/resources/3_0/arrayParameter.yaml", null, new ParseOptions()).getOpenAPI(); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -138,13 +131,11 @@ public abstract class JavaJaxrsBaseTest { openAPI.getComponents().getParameters().get("operationsQueryParam").setSchema(new StringSchema()._default("default")); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); - opts.getProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java index 6d2ac1c23e7..9fda8ba592d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/jaxrs/JavaJerseyServerCodegenTest.java @@ -3,7 +3,6 @@ package org.openapitools.codegen.java.jaxrs; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.servers.Server; import org.openapitools.codegen.ClientOptInput; -import org.openapitools.codegen.ClientOpts; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenOperation; import org.openapitools.codegen.MockDefaultGenerator; @@ -97,11 +96,9 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest { ((JavaJerseyServerCodegen) codegen).setUseTags(false); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); @@ -176,11 +173,9 @@ public class JavaJerseyServerCodegenTest extends JavaJaxrsBaseTest { ((JavaJerseyServerCodegen) codegen).setUseTags(true); codegen.setOutputDir(output.getAbsolutePath()); - ClientOpts opts = new ClientOpts(); ClientOptInput input = new ClientOptInput(); input.setOpenAPI(openAPI); input.setConfig(codegen); - input.setOpts(opts); MockDefaultGenerator generator = new MockDefaultGenerator(); generator.opts(input).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java index 8059873a453..a611aa8b1a9 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/spring/SpringCodegenTest.java @@ -17,15 +17,29 @@ package org.openapitools.codegen.java.spring; +import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.info.Info; import io.swagger.v3.oas.models.servers.Server; +import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.MockDefaultGenerator; import org.openapitools.codegen.languages.SpringCodegen; +import org.openapitools.codegen.languages.features.CXFServerFeatures; import org.testng.Assert; import org.testng.annotations.Test; +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +import static java.util.stream.Collectors.groupingBy; import static org.openapitools.codegen.languages.SpringCodegen.RESPONSE_WRAPPER; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; public class SpringCodegenTest { @@ -122,4 +136,43 @@ public class SpringCodegenTest { Assert.assertEquals(codegen.additionalProperties().get("jdk8"), false); } + + @Test + public void doNotGenerateRequestParamForObjectQueryParam() throws IOException { + File output = Files.createTempDirectory("test").toFile().getCanonicalFile(); + output.deleteOnExit(); + String outputPath = output.getAbsolutePath().replace('\\', '/'); + + OpenAPI openAPI = new OpenAPIParser() + .readLocation("src/test/resources/3_0/objectQueryParam.yaml", null, new ParseOptions()).getOpenAPI(); + + SpringCodegen codegen = new SpringCodegen(); + codegen.setOutputDir(output.getAbsolutePath()); + codegen.additionalProperties().put(CXFServerFeatures.LOAD_TEST_DATA_FROM_FILE, "true"); + + ClientOptInput input = new ClientOptInput(); + input.setOpenAPI(openAPI); + input.setConfig(codegen); + + MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(input).generate(); + + checkFileNotContains(generator, outputPath + "/src/main/java/org/openapitools/api/PonyApi.java", "@RequestParam"); + } + + private void checkFileNotContains(MockDefaultGenerator generator, String path, String... lines) { + String file = generator.getFiles().get(path); + assertNotNull(file); + for (String line : lines) + assertFalse(file.contains(line)); + } + + @Test + public void clientOptsUnicity() { + SpringCodegen codegen = new SpringCodegen(); + codegen.cliOptions() + .stream() + .collect(groupingBy(CliOption::getOpt)) + .forEach((k,v) -> assertEquals(v.size(), 1, k + " is described multiple times")); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java index 87847e16cf7..c830cd29b96 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -47,6 +47,7 @@ public class KotlinSpringServerCodegenTest { codegen.setServiceInterface(true); codegen.setServiceImplementation(true); codegen.setUseBeanValidation(false); + codegen.setReactive(false); codegen.processOpts(); Assert.assertEquals(codegen.modelPackage(), "xx.yyyyyyyy.model"); @@ -69,6 +70,8 @@ public class KotlinSpringServerCodegenTest { Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); Assert.assertFalse(codegen.getUseBeanValidation()); Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + Assert.assertFalse(codegen.isReactive()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false); } @Test @@ -84,6 +87,7 @@ public class KotlinSpringServerCodegenTest { codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_INTERFACE, true); codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION, true); codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_BEANVALIDATION, false); + codegen.additionalProperties().put(KotlinSpringServerCodegen.REACTIVE, false); codegen.processOpts(); final OpenAPI openAPI = new OpenAPI(); @@ -112,6 +116,8 @@ public class KotlinSpringServerCodegenTest { Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); Assert.assertFalse(codegen.getUseBeanValidation()); Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + Assert.assertFalse(codegen.isReactive()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.REACTIVE), false); } @Test diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java index 9e79d0ea0a0..39dc5d06ab8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoClientOptionsProvider.java @@ -29,6 +29,7 @@ public class GoClientOptionsProvider implements OptionsProvider { public static final boolean WITH_GO_CODEGEN_COMMENT_VALUE = true; public static final boolean WITH_XML_VALUE = true; public static final Boolean PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = true; + public static final boolean IS_GO_SUBMODULE_VALUE = true; @Override public String getLanguage() { @@ -45,6 +46,7 @@ public class GoClientOptionsProvider implements OptionsProvider { .put(CodegenConstants.WITH_GO_CODEGEN_COMMENT, "true") .put(CodegenConstants.WITH_XML, "true") .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true") + .put(CodegenConstants.IS_GO_SUBMODULE, "true") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index b0a5bf59604..922c8c4b520 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -53,7 +53,7 @@ public class RubyClientCodegenTest { CodegenConfig codegenConfig = new RubyClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); - ClientOptInput clientOptInput = new ClientOptInput().opts(new ClientOpts()).openAPI(openAPI).config(codegenConfig); + ClientOptInput clientOptInput = new ClientOptInput().openAPI(openAPI).config(codegenConfig); DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(clientOptInput).generate(); @@ -117,7 +117,7 @@ public class RubyClientCodegenTest { CodegenConfig codegenConfig = new RubyClientCodegen(); codegenConfig.setOutputDir(output.getAbsolutePath()); - ClientOptInput clientOptInput = new ClientOptInput().opts(new ClientOpts()).openAPI(openAPI).config(codegenConfig); + ClientOptInput clientOptInput = new ClientOptInput().openAPI(openAPI).config(codegenConfig); DefaultGenerator generator = new DefaultGenerator(); List files = generator.opts(clientOptInput).generate(); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/yaml/YamlGeneratorTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/yaml/YamlGeneratorTest.java new file mode 100644 index 00000000000..05926b9a40a --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/yaml/YamlGeneratorTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.yaml; + +import org.openapitools.codegen.ClientOptInput; +import org.openapitools.codegen.MockDefaultGenerator; +import org.openapitools.codegen.TestUtils; +import org.openapitools.codegen.config.CodegenConfigurator; +import org.openapitools.codegen.languages.OpenAPIYamlGenerator; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.io.File; +import java.nio.file.Files; +import java.util.HashMap; +import java.util.Map; + +public class YamlGeneratorTest { + + @Test + public void testGeneratePing() throws Exception { + Map properties = new HashMap<>(); + + File output = Files.createTempDirectory("test").toFile(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("openapi-yaml") + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(clientOptInput).generate(); + + Map generatedFiles = generator.getFiles(); + Assert.assertEquals(generatedFiles.size(), 4); + TestUtils.ensureContainsFile(generatedFiles, output, "openapi/openapi.yaml"); + TestUtils.ensureContainsFile(generatedFiles, output, "README.md"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION"); + + output.deleteOnExit(); + } + + + @Test + public void testGeneratePingOtherOutputFile() throws Exception { + Map properties = new HashMap<>(); + properties.put(OpenAPIYamlGenerator.OUTPUT_NAME, "ping.yaml"); + + File output = Files.createTempDirectory("test").toFile(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("openapi-yaml") + .setAdditionalProperties(properties) + .setInputSpec("src/test/resources/3_0/ping.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + final ClientOptInput clientOptInput = configurator.toClientOptInput(); + MockDefaultGenerator generator = new MockDefaultGenerator(); + generator.opts(clientOptInput).generate(); + + Map generatedFiles = generator.getFiles(); + Assert.assertEquals(generatedFiles.size(), 4); + TestUtils.ensureContainsFile(generatedFiles, output, "ping.yaml"); + TestUtils.ensureContainsFile(generatedFiles, output, "README.md"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore"); + TestUtils.ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION"); + + output.deleteOnExit(); + } +} diff --git a/modules/openapi-generator/src/test/resources/2_0/mapArgs.yaml b/modules/openapi-generator/src/test/resources/2_0/mapArgs.yaml new file mode 100644 index 00000000000..c023311ae45 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/2_0/mapArgs.yaml @@ -0,0 +1,358 @@ +--- +swagger: '2.0' +info: + version: 0.10.190 + title: LUSID API +paths: + "/api/instruments": + post: + tags: + - Instruments + summary: Upsert instruments + description: Upsert instruments + operationId: UpsertInstruments + consumes: [] + produces: + - text/plain + - application/json + - text/json + parameters: + - name: requests + in: body + description: The instrument definitions + required: false + schema: + type: object + additionalProperties: + "$ref": "#/definitions/InstrumentDefinition" + responses: + '201': + description: Success + schema: + type: object + additionalProperties: + "$ref": "#/definitions/UpsertInstrumentsResponse" + '400': + description: The details of the input related failure + schema: + type: object + additionalProperties: + "$ref": "#/definitions/LusidValidationProblemDetails" + default: + description: Error response + schema: + type: object + additionalProperties: + "$ref": "#/definitions/LusidProblemDetails" +definitions: + Link: + required: + - relation + - href + - method + type: object + properties: + relation: + enum: + - Root + - Properties + - Transactions + - Details + - Constituents + - Holdings + - Commands + - HoldingsAdjustments + - Parent + - PropertySchema + - EntitySchema + - NextPage + - PreviousPage + - Quote + - ConstituentsAdjustments + - Values + type: string + href: + type: string + description: + type: string + method: + enum: + - POST + - GET + - PATCH + - DELETE + type: string + LusidValidationProblemDetails: + required: + - name + - code + type: object + properties: + name: + type: string + errorDetails: + uniqueItems: false + type: array + items: + type: object + additionalProperties: + type: string + code: + format: int32 + type: integer + errors: + type: object + additionalProperties: + uniqueItems: false + type: array + items: + type: string + readOnly: true + type: + type: string + title: + type: string + status: + format: int32 + type: integer + detail: + type: string + instance: + type: string + LusidProblemDetails: + required: + - name + - code + type: object + properties: + name: + type: string + errorDetails: + uniqueItems: false + type: array + items: + type: object + additionalProperties: + type: string + code: + format: int32 + type: integer + type: + type: string + title: + type: string + status: + format: int32 + type: integer + detail: + type: string + instance: + type: string + ResourceId: + type: object + properties: + scope: + type: string + code: + type: string + Version: + description: Describes the version metadata of an entity. + type: object + properties: + effectiveFrom: + format: date-time + description: '' + type: string + asAtDate: + format: date-time + description: '' + type: string + ErrorDetail: + type: object + properties: + id: + type: string + type: + type: string + detail: + type: string + InstrumentDefinition: + required: + - name + - identifiers + type: object + properties: + name: + description: Required. The name of the instrument + type: string + identifiers: + description: Required. A set of identifiers that identify this instrument + type: object + additionalProperties: + "$ref": "#/definitions/InstrumentIdValue" + properties: + description: Optional. A collection of properties to upsert on the instrument. + uniqueItems: false + type: array + items: + "$ref": "#/definitions/InstrumentProperty" + lookThroughPortfolioId: + "$ref": "#/definitions/ResourceId" + description: Optional. The identifier of the portfolio that represents this + instrument. + definition: + "$ref": "#/definitions/InstrumentEconomicDefinition" + description: Expanded instrument definition + InstrumentIdValue: + required: + - value + type: object + properties: + value: + description: The value of the instrument id, which must not be empty or null. + e.g, 'BBG123456' + type: string + effectiveAt: + format: date-time + description: "The effective at date of the instrument id, which is optional. + The default value in the null case\r\nis DateTimeOffset.MinValue." + type: string + InstrumentProperty: + type: object + properties: + key: + description: The property key of the property, e.g, 'Instrument/default/Isin' + type: string + value: + "$ref": "#/definitions/PropertyValue" + description: The value of the property, which must not be empty or null. e.g, + 'US0378331005' + InstrumentEconomicDefinition: + description: Expanded instrument definition + required: + - instrumentFormat + - content + type: object + properties: + instrumentFormat: + type: string + content: + type: string + PropertyValue: + type: object + properties: + labelValue: + description: '' + type: string + metricValue: + "$ref": "#/definitions/MetricValue" + description: '' + effectiveFrom: + format: date-time + description: Date for which the property is effective from + type: string + MetricValue: + type: object + properties: + value: + format: double + type: number + unit: + type: string + UpsertInstrumentsResponse: + type: object + properties: + href: + type: string + values: + description: The collection of upserted instruments with their latest parameters. + type: object + additionalProperties: + "$ref": "#/definitions/Instrument" + failed: + description: "If any instruments failed to be upserted, they will be listed + in 'Failed', along\r\nwith a reason why." + type: object + additionalProperties: + "$ref": "#/definitions/ErrorDetail" + links: + uniqueItems: false + type: array + items: + "$ref": "#/definitions/Link" + Instrument: + required: + - state + type: object + properties: + href: + type: string + lusidInstrumentId: + description: The lusid instrument id (LUID) of the instrument + type: string + version: + "$ref": "#/definitions/Version" + description: The version of the instrument + name: + description: The name of the instrument + type: string + identifiers: + description: The set of identifiers that can be used to uniquely identify + the instrument + type: object + additionalProperties: + type: string + properties: + description: "Any requested instrument properties. If no property can be found + for the instrument, then\r\na value of 'Unknown' will be returned" + uniqueItems: false + type: array + items: + "$ref": "#/definitions/Property" + lookthroughPortfolio: + "$ref": "#/definitions/ResourceId" + description: The lookthrough portfolio of the instrument (if any). + instrumentDefinition: + "$ref": "#/definitions/InstrumentEconomicDefinition" + description: The economic definition of the instrument for an OTC or instrument + where an expanded definition exists. + state: + enum: + - Active + - Inactive + type: string + links: + uniqueItems: false + type: array + items: + "$ref": "#/definitions/Link" + Property: + required: + - key + - value + type: object + properties: + key: + description: '' + type: string + value: + description: '' + type: object + unit: + description: '' + type: string + effectiveFrom: + format: date-time + description: Date for which the property is effective from + type: string +securityDefinitions: + oauth2: + flow: implicit + authorizationUrl: https://lusid.okta.com/oauth2/aus5al5yopbHW2wJn2p6/v1/authorize + type: oauth2 + description: OAuth2 Implicit Grant +security: + - oauth2: [] +tags: + - name: Instruments + description: Methods for interacting with instruments diff --git a/modules/openapi-generator/src/test/resources/3_0/objectQueryParam.yaml b/modules/openapi-generator/src/test/resources/3_0/objectQueryParam.yaml new file mode 100644 index 00000000000..cddf5495fed --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/objectQueryParam.yaml @@ -0,0 +1,25 @@ +openapi: 3.0.0 +servers: + - url: 'localhost:8080' +info: + version: 1.0.0 + title: OpenAPI Petstore + license: + name: Apache-2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /pony: + get: + operationId: list + parameters: + - in: query + name: pageQuery + schema: + type: object + properties: + offset: + type: integer + format: int32 + limit: + type: integer + format: int32 \ No newline at end of file diff --git a/pom.xml b/pom.xml index fed1405d269..63bce98c590 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,9 @@ openapi-generator-project pom openapi-generator-project + 5.0.0-SNAPSHOT + https://github.com/openapitools/openapi-generator scm:git:git@github.com:openapitools/openapi-generator.git @@ -38,23 +40,20 @@ cbornet Christophe Bornet - - jaz-ah - Joseph Zuromski - ackintosh Akihito Nakano - - JFCote - Jean-François Côté - jmini Jérémie Bresson dev@jmini.fr + + etherealjoy + Sunn + sunn.ssb@live.com + github @@ -156,12 +155,22 @@ maven-surefire-plugin ${surefire-version} + true false none:none org.testng:testng -XX:+StartAttachListener -javaagent:"${settings.localRepository}/org/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar" + + + + org.jmockit + jmockit + ${jmockit-version} + compile + + maven-dependency-plugin @@ -1287,12 +1296,12 @@ + modules/openapi-generator-core modules/openapi-generator modules/openapi-generator-cli modules/openapi-generator-maven-plugin modules/openapi-generator-gradle-plugin modules/openapi-generator-online - modules/openapi-generator-core target/site @@ -1374,8 +1383,8 @@ 1.14 4.1.2 6.14.3 - 2.22.1 - 1.43 + 3.0.0-M3 + 1.46 0.9.10
diff --git a/samples/client/petstore/R/R/api_client.R b/samples/client/petstore/R/R/api_client.R index d4a6262475d..ec5af87dd39 100644 --- a/samples/client/petstore/R/R/api_client.R +++ b/samples/client/petstore/R/R/api_client.R @@ -45,8 +45,10 @@ ApiClient <- R6::R6Class( apiKeys = NULL, # Access token accessToken = NULL, + # Time Out (seconds) + timeout = NULL, # constructor - initialize = function(basePath=NULL, userAgent=NULL, defaultHeaders=NULL, username=NULL, password=NULL, apiKeys=NULL, accessToken=NULL){ + initialize = function(basePath=NULL, userAgent=NULL, defaultHeaders=NULL, username=NULL, password=NULL, apiKeys=NULL, accessToken=NULL, timeout=NULL){ if (!is.null(basePath)) { self$basePath <- basePath } @@ -76,25 +78,76 @@ ApiClient <- R6::R6Class( if (!is.null(userAgent)) { self$`userAgent` <- userAgent } + + if (!is.null(timeout)) { + self$timeout <- timeout + } }, CallApi = function(url, method, queryParams, headerParams, body, ...){ headers <- httr::add_headers(c(headerParams, self$defaultHeaders)) + httpTimeout <- NULL + if (!is.null(self$timeout)) { + httpTimeout <- httr::timeout(self$timeout) + } + if (method == "GET") { - httr::GET(url, queryParams, headers, ...) + httr::GET(url, query = queryParams, headers, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "POST") { - httr::POST(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::POST(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "PUT") { - httr::PUT(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::PUT(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "PATCH") { - httr::PATCH(url, query = queryParams, headers, body = body, httr::content_type("application/json"), ...) + httr::PATCH(url, query = queryParams, headers, body = body, httr::content_type("application/json"), httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "HEAD") { - httr::HEAD(url, query = queryParams, headers, ...) + httr::HEAD(url, query = queryParams, headers, httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else if (method == "DELETE") { - httr::DELETE(url, query = queryParams, headers, ...) + httr::DELETE(url, query = queryParams, headers, httpTimeout, httpTimeout, httr::user_agent(self$`userAgent`), ...) } else { stop("http method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.") } + }, + + deserialize = function(resp, returnType, pkgEnv) { + respObj <- jsonlite::fromJSON(httr::content(resp, "text", encoding = "UTF-8")) + self$deserializeObj(respObj, returnType, pkgEnv) + }, + + deserializeObj = function(obj, returnType, pkgEnv) { + returnObj <- NULL + primitiveTypes <- c("character", "numeric", "integer", "logical", "complex") + + if (startsWith(returnType, "map(")) { + innerReturnType <- regmatches(returnType, regexec(pattern = "map\\((.*)\\)", returnType))[[1]][2] + returnObj <- lapply(names(obj), function(name) { + self$deserializeObj(obj[[name]], innerReturnType, pkgEnv) + }) + names(returnObj) <- names(obj) + } else if (startsWith(returnType, "array[")) { + innerReturnType <- regmatches(returnType, regexec(pattern = "array\\[(.*)\\]", returnType))[[1]][2] + if (c(innerReturnType) %in% primitiveTypes) { + returnObj <- vector("list", length = length(obj)) + if (length(obj) > 0) { + for (row in 1:length(obj)) { + returnObj[[row]] <- self$deserializeObj(obj[row], innerReturnType, pkgEnv) + } + } + } else { + returnObj <- vector("list", length = nrow(obj)) + if (nrow(obj) > 0) { + for (row in 1:nrow(obj)) { + returnObj[[row]] <- self$deserializeObj(obj[row, , drop = FALSE], innerReturnType, pkgEnv) + } + } + } + } else if (exists(returnType, pkgEnv) && !(c(returnType) %in% primitiveTypes)) { + returnType <- get(returnType, envir = as.environment(pkgEnv)) + returnObj <- returnType$new() + returnObj$fromJSON(jsonlite::toJSON(obj, digits = NA)) + } else { + returnObj <- obj + } + returnObj } ) ) diff --git a/samples/client/petstore/R/R/category.R b/samples/client/petstore/R/R/category.R index fea3501c6fa..de662eaed4c 100644 --- a/samples/client/petstore/R/R/category.R +++ b/samples/client/petstore/R/R/category.R @@ -54,16 +54,24 @@ Category <- R6::R6Class( } }, toJSONString = function() { - sprintf( - '{ - "id": - %d, - "name": - "%s" - }', - self$`id`, + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + )}, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', self$`name` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(CategoryJson) { CategoryObject <- jsonlite::fromJSON(CategoryJson) diff --git a/samples/client/petstore/R/R/model_api_response.R b/samples/client/petstore/R/R/model_api_response.R index 425c6380457..5985ed033c0 100644 --- a/samples/client/petstore/R/R/model_api_response.R +++ b/samples/client/petstore/R/R/model_api_response.R @@ -67,19 +67,31 @@ ModelApiResponse <- R6::R6Class( } }, toJSONString = function() { - sprintf( - '{ - "code": - %d, - "type": - "%s", - "message": - "%s" - }', - self$`code`, - self$`type`, + jsoncontent <- c( + if (!is.null(self$`code`)) { + sprintf( + '"code": + %d + ', + self$`code` + )}, + if (!is.null(self$`type`)) { + sprintf( + '"type": + "%s" + ', + self$`type` + )}, + if (!is.null(self$`message`)) { + sprintf( + '"message": + "%s" + ', self$`message` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(ModelApiResponseJson) { ModelApiResponseObject <- jsonlite::fromJSON(ModelApiResponseJson) diff --git a/samples/client/petstore/R/R/order.R b/samples/client/petstore/R/R/order.R index 76f908c39a2..839db2951c4 100644 --- a/samples/client/petstore/R/R/order.R +++ b/samples/client/petstore/R/R/order.R @@ -105,28 +105,52 @@ Order <- R6::R6Class( } }, toJSONString = function() { - sprintf( - '{ - "id": - %d, - "petId": - %d, - "quantity": - %d, - "shipDate": - "%s", - "status": - "%s", - "complete": - "%s" - }', - self$`id`, - self$`petId`, - self$`quantity`, - self$`shipDate`, - self$`status`, + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + )}, + if (!is.null(self$`petId`)) { + sprintf( + '"petId": + %d + ', + self$`petId` + )}, + if (!is.null(self$`quantity`)) { + sprintf( + '"quantity": + %d + ', + self$`quantity` + )}, + if (!is.null(self$`shipDate`)) { + sprintf( + '"shipDate": + "%s" + ', + self$`shipDate` + )}, + if (!is.null(self$`status`)) { + sprintf( + '"status": + "%s" + ', + self$`status` + )}, + if (!is.null(self$`complete`)) { + sprintf( + '"complete": + "%s" + ', self$`complete` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(OrderJson) { OrderObject <- jsonlite::fromJSON(OrderJson) diff --git a/samples/client/petstore/R/R/pet.R b/samples/client/petstore/R/R/pet.R index 11d5811a0f5..69c67d243d6 100644 --- a/samples/client/petstore/R/R/pet.R +++ b/samples/client/petstore/R/R/pet.R @@ -93,63 +93,77 @@ Pet <- R6::R6Class( } if (!is.null(PetObject$`category`)) { categoryObject <- Category$new() - categoryObject$fromJSON(jsonlite::toJSON(PetObject$category, auto_unbox = TRUE)) + categoryObject$fromJSON(jsonlite::toJSON(PetObject$category, auto_unbox = TRUE, digits = NA)) self$`category` <- categoryObject } if (!is.null(PetObject$`name`)) { self$`name` <- PetObject$`name` } if (!is.null(PetObject$`photoUrls`)) { - self$`photoUrls` <- PetObject$`photoUrls` + self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]", "package:petstore") } if (!is.null(PetObject$`tags`)) { - self$`tags` <- sapply(PetObject$`tags`, function(x) { - tagsObject <- Tag$new() - tagsObject$fromJSON(jsonlite::toJSON(x, auto_unbox = TRUE)) - tagsObject - }) + self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]", "package:petstore") } if (!is.null(PetObject$`status`)) { self$`status` <- PetObject$`status` } }, toJSONString = function() { - sprintf( - '{ - "id": - %d, - "category": - %s, - "name": - "%s", - "photoUrls": - [%s], - "tags": - [%s], - "status": - "%s" - }', - self$`id`, - jsonlite::toJSON(self$`category`$toJSON(), auto_unbox=TRUE), - self$`name`, - paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse=","), - paste(unlist(lapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE))), collapse=","), + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + )}, + if (!is.null(self$`category`)) { + sprintf( + '"category": + %s + ', + jsonlite::toJSON(self$`category`$toJSON(), auto_unbox=TRUE, digits = NA) + )}, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', + self$`name` + )}, + if (!is.null(self$`photoUrls`)) { + sprintf( + '"photoUrls": + [%s] + ', + paste(unlist(lapply(self$`photoUrls`, function(x) paste0('"', x, '"'))), collapse=",") + )}, + if (!is.null(self$`tags`)) { + sprintf( + '"tags": + [%s] +', + paste(unlist(lapply(self$`tags`, function(x) jsonlite::toJSON(x$toJSON(), auto_unbox=TRUE, digits = NA))), collapse=",") + )}, + if (!is.null(self$`status`)) { + sprintf( + '"status": + "%s" + ', self$`status` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(PetJson) { PetObject <- jsonlite::fromJSON(PetJson) self$`id` <- PetObject$`id` - self$`category` <- Category$new()$fromJSON(jsonlite::toJSON(PetObject$category, auto_unbox = TRUE)) + self$`category` <- Category$new()$fromJSON(jsonlite::toJSON(PetObject$category, auto_unbox = TRUE, digits = NA)) self$`name` <- PetObject$`name` - self$`photoUrls` <- lapply(PetObject$`photoUrls`, function (x) x) - data.frame <- PetObject$`tags` - self$`tags` <- vector("list", length = nrow(data.frame)) - for (row in 1:nrow(data.frame)) { - tags.node <- Tag$new() - tags.node$fromJSON(jsonlite::toJSON(data.frame[row,,drop = TRUE], auto_unbox = TRUE)) - self$`tags`[[row]] <- tags.node - } + self$`photoUrls` <- ApiClient$new()$deserializeObj(PetObject$`photoUrls`, "array[character]","package:petstore") + self$`tags` <- ApiClient$new()$deserializeObj(PetObject$`tags`, "array[Tag]","package:petstore") self$`status` <- PetObject$`status` self } diff --git a/samples/client/petstore/R/R/pet_api.R b/samples/client/petstore/R/R/pet_api.R index a098c5b747b..6855f64ffdd 100644 --- a/samples/client/petstore/R/R/pet_api.R +++ b/samples/client/petstore/R/R/pet_api.R @@ -57,6 +57,18 @@ PetApi <- R6::R6Class( } }, AddPet = function(body, ...){ + apiResponse <- self$AddPetWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + AddPetWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -83,15 +95,26 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, DeletePet = function(pet.id, api.key=NULL, ...){ + apiResponse <- self$DeletePetWithHttpInfo(pet.id, api.key, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + DeletePetWithHttpInfo = function(pet.id, api.key=NULL, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -118,15 +141,26 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, FindPetsByStatus = function(status, ...){ + apiResponse <- self$FindPetsByStatusWithHttpInfo(status, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + FindPetsByStatusWithHttpInfo = function(status, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -149,15 +183,27 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - Pet$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "array[Pet]", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, FindPetsByTags = function(tags, ...){ + apiResponse <- self$FindPetsByTagsWithHttpInfo(tags, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + FindPetsByTagsWithHttpInfo = function(tags, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -180,15 +226,27 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - Pet$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "array[Pet]", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, GetPetById = function(pet.id, ...){ + apiResponse <- self$GetPetByIdWithHttpInfo(pet.id, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + GetPetByIdWithHttpInfo = function(pet.id, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -215,15 +273,27 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - Pet$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "Pet", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, UpdatePet = function(body, ...){ + apiResponse <- self$UpdatePetWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + UpdatePetWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -250,15 +320,26 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, UpdatePetWithForm = function(pet.id, name=NULL, status=NULL, ...){ + apiResponse <- self$UpdatePetWithFormWithHttpInfo(pet.id, name, status, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + UpdatePetWithFormWithHttpInfo = function(pet.id, name=NULL, status=NULL, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -288,15 +369,26 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, UploadFile = function(pet.id, additional.metadata=NULL, file=NULL, ...){ + apiResponse <- self$UploadFileWithHttpInfo(pet.id, additional.metadata, file, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + UploadFileWithHttpInfo = function(pet.id, additional.metadata=NULL, file=NULL, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -326,13 +418,13 @@ PetApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - ModelApiResponse$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "ModelApiResponse", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - } ) ) diff --git a/samples/client/petstore/R/R/store_api.R b/samples/client/petstore/R/R/store_api.R index 5113c5d86e6..6466a80e0f7 100644 --- a/samples/client/petstore/R/R/store_api.R +++ b/samples/client/petstore/R/R/store_api.R @@ -45,6 +45,18 @@ StoreApi <- R6::R6Class( } }, DeleteOrder = function(order.id, ...){ + apiResponse <- self$DeleteOrderWithHttpInfo(order.id, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + DeleteOrderWithHttpInfo = function(order.id, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -67,15 +79,26 @@ StoreApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, GetInventory = function(...){ + apiResponse <- self$GetInventoryWithHttpInfo(...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + GetInventoryWithHttpInfo = function(...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -94,15 +117,27 @@ StoreApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - integer$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "map(integer)", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, GetOrderById = function(order.id, ...){ + apiResponse <- self$GetOrderByIdWithHttpInfo(order.id, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + GetOrderByIdWithHttpInfo = function(order.id, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -125,15 +160,27 @@ StoreApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - Order$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "Order", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, PlaceOrder = function(body, ...){ + apiResponse <- self$PlaceOrderWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + PlaceOrderWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -158,13 +205,13 @@ StoreApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - Order$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "Order", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - } ) ) diff --git a/samples/client/petstore/R/R/tag.R b/samples/client/petstore/R/R/tag.R index b0ee474e18d..279c43d59d4 100644 --- a/samples/client/petstore/R/R/tag.R +++ b/samples/client/petstore/R/R/tag.R @@ -54,16 +54,24 @@ Tag <- R6::R6Class( } }, toJSONString = function() { - sprintf( - '{ - "id": - %d, - "name": - "%s" - }', - self$`id`, + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + )}, + if (!is.null(self$`name`)) { + sprintf( + '"name": + "%s" + ', self$`name` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(TagJson) { TagObject <- jsonlite::fromJSON(TagJson) diff --git a/samples/client/petstore/R/R/user.R b/samples/client/petstore/R/R/user.R index 2431ff8de4c..8377f5a68ef 100644 --- a/samples/client/petstore/R/R/user.R +++ b/samples/client/petstore/R/R/user.R @@ -132,34 +132,66 @@ User <- R6::R6Class( } }, toJSONString = function() { - sprintf( - '{ - "id": - %d, - "username": - "%s", - "firstName": - "%s", - "lastName": - "%s", - "email": - "%s", - "password": - "%s", - "phone": - "%s", - "userStatus": - %d - }', - self$`id`, - self$`username`, - self$`firstName`, - self$`lastName`, - self$`email`, - self$`password`, - self$`phone`, + jsoncontent <- c( + if (!is.null(self$`id`)) { + sprintf( + '"id": + %d + ', + self$`id` + )}, + if (!is.null(self$`username`)) { + sprintf( + '"username": + "%s" + ', + self$`username` + )}, + if (!is.null(self$`firstName`)) { + sprintf( + '"firstName": + "%s" + ', + self$`firstName` + )}, + if (!is.null(self$`lastName`)) { + sprintf( + '"lastName": + "%s" + ', + self$`lastName` + )}, + if (!is.null(self$`email`)) { + sprintf( + '"email": + "%s" + ', + self$`email` + )}, + if (!is.null(self$`password`)) { + sprintf( + '"password": + "%s" + ', + self$`password` + )}, + if (!is.null(self$`phone`)) { + sprintf( + '"phone": + "%s" + ', + self$`phone` + )}, + if (!is.null(self$`userStatus`)) { + sprintf( + '"userStatus": + %d + ', self$`userStatus` + )} ) + jsoncontent <- paste(jsoncontent, collapse = ",") + paste('{', jsoncontent, '}', sep = "") }, fromJSONString = function(UserJson) { UserObject <- jsonlite::fromJSON(UserJson) diff --git a/samples/client/petstore/R/R/user_api.R b/samples/client/petstore/R/R/user_api.R index 1d2eb03a14c..656e1acd683 100644 --- a/samples/client/petstore/R/R/user_api.R +++ b/samples/client/petstore/R/R/user_api.R @@ -57,6 +57,18 @@ UserApi <- R6::R6Class( } }, CreateUser = function(body, ...){ + apiResponse <- self$CreateUserWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + CreateUserWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -81,15 +93,26 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, CreateUsersWithArrayInput = function(body, ...){ + apiResponse <- self$CreateUsersWithArrayInputWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + CreateUsersWithArrayInputWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -99,7 +122,8 @@ UserApi <- R6::R6Class( } if (!missing(`body`)) { - body <- `body`$toJSONString() + body.items = paste(unlist(lapply(body, function(param){param$toJSONString()})), collapse = ",") + body <- paste0('[', body.items, ']') } else { body <- NULL } @@ -114,15 +138,26 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, CreateUsersWithListInput = function(body, ...){ + apiResponse <- self$CreateUsersWithListInputWithHttpInfo(body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + CreateUsersWithListInputWithHttpInfo = function(body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -132,7 +167,8 @@ UserApi <- R6::R6Class( } if (!missing(`body`)) { - body <- `body`$toJSONString() + body.items = paste(unlist(lapply(body, function(param){param$toJSONString()})), collapse = ",") + body <- paste0('[', body.items, ']') } else { body <- NULL } @@ -147,15 +183,26 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, DeleteUser = function(username, ...){ + apiResponse <- self$DeleteUserWithHttpInfo(username, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + DeleteUserWithHttpInfo = function(username, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -178,15 +225,26 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, GetUserByName = function(username, ...){ + apiResponse <- self$GetUserByNameWithHttpInfo(username, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + GetUserByNameWithHttpInfo = function(username, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -209,15 +267,27 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - User$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "User", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, LoginUser = function(username, password, ...){ + apiResponse <- self$LoginUserWithHttpInfo(username, password, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + LoginUserWithHttpInfo = function(username, password, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -244,15 +314,27 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - character$new()$fromJSONString(httr::content(resp, "text", encoding = "UTF-8")) + deserializedRespObj <- self$apiClient$deserialize(resp, "character", "package:petstore") + ApiResponse$new(deserializedRespObj, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, LogoutUser = function(...){ + apiResponse <- self$LogoutUserWithHttpInfo(...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + LogoutUserWithHttpInfo = function(...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -267,15 +349,26 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - }, UpdateUser = function(username, body, ...){ + apiResponse <- self$UpdateUserWithHttpInfo(username, body, ...) + resp <- apiResponse$response + if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { + apiResponse$content + } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { + apiResponse + } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { + apiResponse + } + }, + + UpdateUserWithHttpInfo = function(username, body, ...){ args <- list(...) queryParams <- list() headerParams <- c() @@ -308,13 +401,12 @@ UserApi <- R6::R6Class( ...) if (httr::status_code(resp) >= 200 && httr::status_code(resp) <= 299) { - # void response, no need to return anything + ApiResponse$new(NULL, resp) } else if (httr::status_code(resp) >= 400 && httr::status_code(resp) <= 499) { ApiResponse$new("API client error", resp) } else if (httr::status_code(resp) >= 500 && httr::status_code(resp) <= 599) { ApiResponse$new("API server error", resp) } - } ) ) diff --git a/samples/client/petstore/R/docs/Pet.md b/samples/client/petstore/R/docs/Pet.md index 296dfdeea43..f5a9c0dd611 100644 --- a/samples/client/petstore/R/docs/Pet.md +++ b/samples/client/petstore/R/docs/Pet.md @@ -6,8 +6,8 @@ Name | Type | Description | Notes **id** | **integer** | | [optional] **category** | [**Category**](Category.md) | | [optional] **name** | **character** | | -**photoUrls** | **character** | | -**tags** | [**Tag**](Tag.md) | | [optional] +**photoUrls** | **array[character]** | | +**tags** | [**array[Tag]**](Tag.md) | | [optional] **status** | **character** | pet status in the store | [optional] diff --git a/samples/client/petstore/R/docs/PetApi.md b/samples/client/petstore/R/docs/PetApi.md index 186fd50d92c..fe69ffb556f 100644 --- a/samples/client/petstore/R/docs/PetApi.md +++ b/samples/client/petstore/R/docs/PetApi.md @@ -95,7 +95,7 @@ void (empty response body) # **FindPetsByStatus** -> Pet FindPetsByStatus(status) +> array[Pet] FindPetsByStatus(status) Finds Pets by status @@ -105,7 +105,7 @@ Multiple status values can be provided with comma separated strings ```R library(petstore) -var.status <- list("status_example") # character | Status values that need to be considered for filter +var.status <- list("status_example") # array[character] | Status values that need to be considered for filter #Finds Pets by status api.instance <- PetApi$new() @@ -119,11 +119,11 @@ dput(result) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**character**](character.md)| Status values that need to be considered for filter | + **status** | [**array[character]**](character.md)| Status values that need to be considered for filter | ### Return type -[**Pet**](Pet.md) +[**array[Pet]**](Pet.md) ### Authorization @@ -137,7 +137,7 @@ Name | Type | Description | Notes # **FindPetsByTags** -> Pet FindPetsByTags(tags) +> array[Pet] FindPetsByTags(tags) Finds Pets by tags @@ -147,7 +147,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```R library(petstore) -var.tags <- list("inner_example") # character | Tags to filter by +var.tags <- list("inner_example") # array[character] | Tags to filter by #Finds Pets by tags api.instance <- PetApi$new() @@ -161,11 +161,11 @@ dput(result) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**character**](character.md)| Tags to filter by | + **tags** | [**array[character]**](character.md)| Tags to filter by | ### Return type -[**Pet**](Pet.md) +[**array[Pet]**](Pet.md) ### Authorization diff --git a/samples/client/petstore/R/docs/StoreApi.md b/samples/client/petstore/R/docs/StoreApi.md index 8f91944aed1..81970724c12 100644 --- a/samples/client/petstore/R/docs/StoreApi.md +++ b/samples/client/petstore/R/docs/StoreApi.md @@ -50,7 +50,7 @@ No authorization required # **GetInventory** -> integer GetInventory() +> map(integer) GetInventory() Returns pet inventories by status @@ -74,7 +74,7 @@ This endpoint does not need any parameter. ### Return type -**integer** +**map(integer)** ### Authorization diff --git a/samples/client/petstore/R/docs/UserApi.md b/samples/client/petstore/R/docs/UserApi.md index 342a3b3b40d..c69c5987ed0 100644 --- a/samples/client/petstore/R/docs/UserApi.md +++ b/samples/client/petstore/R/docs/UserApi.md @@ -62,7 +62,7 @@ Creates list of users with given input array ```R library(petstore) -var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # User | List of user object +var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object #Creates list of users with given input array api.instance <- UserApi$new() @@ -73,7 +73,7 @@ api.instance$CreateUsersWithArrayInput(var.body) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](array.md)| List of user object | + **body** | [**array[User]**](User.md)| List of user object | ### Return type @@ -99,7 +99,7 @@ Creates list of users with given input array ```R library(petstore) -var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # User | List of user object +var.body <- list(User$new(123, "username_example", "firstName_example", "lastName_example", "email_example", "password_example", "phone_example", 123)) # array[User] | List of user object #Creates list of users with given input array api.instance <- UserApi$new() @@ -110,7 +110,7 @@ api.instance$CreateUsersWithListInput(var.body) Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](array.md)| List of user object | + **body** | [**array[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/cpp-qt5/.openapi-generator/VERSION b/samples/client/petstore/cpp-qt5/.openapi-generator/VERSION index 06b5019af3f..d96260ba335 100644 --- a/samples/client/petstore/cpp-qt5/.openapi-generator/VERSION +++ b/samples/client/petstore/cpp-qt5/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h b/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h index b28590dd38a..2fe8209ac10 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h +++ b/samples/client/petstore/cpp-qt5/client/OAIApiResponse.h @@ -76,4 +76,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIApiResponse) + #endif // OAIApiResponse_H diff --git a/samples/client/petstore/cpp-qt5/client/OAICategory.h b/samples/client/petstore/cpp-qt5/client/OAICategory.h index 0586cb3d4e1..129d9748576 100644 --- a/samples/client/petstore/cpp-qt5/client/OAICategory.h +++ b/samples/client/petstore/cpp-qt5/client/OAICategory.h @@ -68,4 +68,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAICategory) + #endif // OAICategory_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIEnum.h b/samples/client/petstore/cpp-qt5/client/OAIEnum.h index 42daef17ac1..a5e619960fb 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIEnum.h +++ b/samples/client/petstore/cpp-qt5/client/OAIEnum.h @@ -15,6 +15,7 @@ #include #include +#include namespace OpenAPI { @@ -61,4 +62,6 @@ private : } +Q_DECLARE_METATYPE(OpenAPI::OAIEnum) + #endif // OAI_ENUM_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp index 01e8797795d..8fdd4ea5e97 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.cpp @@ -54,18 +54,29 @@ OAIHttpRequestWorker::OAIHttpRequestWorker(QObject *parent) : QObject(parent), manager(nullptr) { qsrand(QDateTime::currentDateTime().toTime_t()); - + timeout = 0; + timer = new QTimer(); manager = new QNetworkAccessManager(this); connect(manager, &QNetworkAccessManager::finished, this, &OAIHttpRequestWorker::on_manager_finished); } OAIHttpRequestWorker::~OAIHttpRequestWorker() { + if(timer != nullptr){ + if(timer->isActive()){ + timer->stop(); + } + timer->deleteLater(); + } } QMap OAIHttpRequestWorker::getResponseHeaders() const { return headers; } +void OAIHttpRequestWorker::setTimeOut(int tout){ + timeout = tout; +} + QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QString input) { // result structure follows RFC 5987 bool need_utf_encoding = false; @@ -117,7 +128,7 @@ QString OAIHttpRequestWorker::http_attribute_encode(QString attribute_name, QStr void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { // reset variables - + QNetworkReply* reply = nullptr; QByteArray request_content = ""; response = ""; error_type = QNetworkReply::NoError; @@ -285,19 +296,19 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { } if (input->http_method == "GET") { - manager->get(request); + reply = manager->get(request); } else if (input->http_method == "POST") { - manager->post(request, request_content); + reply = manager->post(request, request_content); } else if (input->http_method == "PUT") { - manager->put(request, request_content); + reply = manager->put(request, request_content); } else if (input->http_method == "HEAD") { - manager->head(request); + reply = manager->head(request); } else if (input->http_method == "DELETE") { - manager->deleteResource(request); + reply = manager->deleteResource(request); } else { #if (QT_VERSION >= 0x050800) @@ -307,11 +318,16 @@ void OAIHttpRequestWorker::execute(OAIHttpRequestInput *input) { buffer->setData(request_content); buffer->open(QIODevice::ReadOnly); - QNetworkReply* reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); + reply = manager->sendCustomRequest(request, input->http_method.toLatin1(), buffer); buffer->setParent(reply); #endif } - + if(timeout > 0){ + timer->setSingleShot(true); + timer->setInterval(timeout); + connect(timer, &QTimer::timeout, this, [=](){ on_manager_timeout(reply); }); + timer->start(); + } } void OAIHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { @@ -327,6 +343,16 @@ void OAIHttpRequestWorker::on_manager_finished(QNetworkReply *reply) { emit on_execution_finished(this); } +void OAIHttpRequestWorker::on_manager_timeout(QNetworkReply *reply) { + error_type = QNetworkReply::TimeoutError; + response = ""; + error_str = "Timed out waiting for response"; + disconnect(manager, nullptr, nullptr, nullptr); + reply->abort(); + reply->deleteLater(); + + emit on_execution_finished(this); +} QSslConfiguration* OAIHttpRequestWorker::sslDefaultConfiguration; diff --git a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h index 5e58caf449b..b7380595c04 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h +++ b/samples/client/petstore/cpp-qt5/client/OAIHttpRequest.h @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -69,7 +70,7 @@ public: QByteArray response; QNetworkReply::NetworkError error_type; QString error_str; - + QTimer *timer; explicit OAIHttpRequestWorker(QObject *parent = nullptr); virtual ~OAIHttpRequestWorker(); @@ -77,16 +78,17 @@ public: QString http_attribute_encode(QString attribute_name, QString input); void execute(OAIHttpRequestInput *input); static QSslConfiguration* sslDefaultConfiguration; - + void setTimeOut(int tout); signals: void on_execution_finished(OAIHttpRequestWorker *worker); private: QNetworkAccessManager *manager; QMap headers; + int timeout; + void on_manager_timeout(QNetworkReply *reply); private slots: - void on_manager_finished(QNetworkReply *reply); - + void on_manager_finished(QNetworkReply *reply); }; } diff --git a/samples/client/petstore/cpp-qt5/client/OAIObject.h b/samples/client/petstore/cpp-qt5/client/OAIObject.h index 9cc379894ca..babc1e64fbb 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIObject.h +++ b/samples/client/petstore/cpp-qt5/client/OAIObject.h @@ -15,6 +15,7 @@ #include #include +#include namespace OpenAPI { @@ -63,4 +64,6 @@ private : } +Q_DECLARE_METATYPE(OpenAPI::OAIObject) + #endif // OAI_OBJECT_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIOrder.h b/samples/client/petstore/cpp-qt5/client/OAIOrder.h index eb9edd329e3..c9b006d3632 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIOrder.h +++ b/samples/client/petstore/cpp-qt5/client/OAIOrder.h @@ -101,4 +101,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIOrder) + #endif // OAIOrder_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIPet.h b/samples/client/petstore/cpp-qt5/client/OAIPet.h index ffeb4ba5ad7..6bec604d216 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPet.h +++ b/samples/client/petstore/cpp-qt5/client/OAIPet.h @@ -103,4 +103,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIPet) + #endif // OAIPet_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp index 46108a18fd7..3e83ea00668 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIPetApi.cpp @@ -19,7 +19,8 @@ namespace OpenAPI { OAIPetApi::OAIPetApi() : basePath("/v2"), - host("petstore.swagger.io") { + host("petstore.swagger.io"), + timeout(0){ } @@ -27,9 +28,10 @@ OAIPetApi::~OAIPetApi() { } -OAIPetApi::OAIPetApi(const QString& host, const QString& basePath) { +OAIPetApi::OAIPetApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; + this->timeout = tout; } void OAIPetApi::setBasePath(const QString& basePath){ @@ -40,6 +42,10 @@ void OAIPetApi::setHost(const QString& host){ this->host = host; } +void OAIPetApi::setApiTimeOutMs(const int tout){ + timeout = tout; +} + void OAIPetApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } @@ -51,6 +57,7 @@ OAIPetApi::addPet(const OAIPet& body) { fullPath.append(this->host).append(this->basePath).append("/pet"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); @@ -102,6 +109,7 @@ OAIPetApi::deletePet(const qint64& pet_id, const QString& api_key) { fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "DELETE"); if (api_key != nullptr) { @@ -189,6 +197,7 @@ OAIPetApi::findPetsByStatus(const QList& status) { } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -283,6 +292,7 @@ OAIPetApi::findPetsByTags(const QList& tags) { } OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -340,6 +350,7 @@ OAIPetApi::getPetById(const qint64& pet_id) { fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -385,6 +396,7 @@ OAIPetApi::updatePet(const OAIPet& body) { fullPath.append(this->host).append(this->basePath).append("/pet"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "PUT"); @@ -436,6 +448,7 @@ OAIPetApi::updatePetWithForm(const qint64& pet_id, const QString& name, const QS fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); if (name != nullptr) { input.add_var("name", name); @@ -489,6 +502,7 @@ OAIPetApi::uploadFile(const qint64& pet_id, const QString& additional_metadata, fullPath.replace(pet_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(pet_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); if (additional_metadata != nullptr) { input.add_var("additionalMetadata", additional_metadata); diff --git a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h index 336b973bdb6..bd64db93db1 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIPetApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIPetApi.h @@ -29,11 +29,12 @@ class OAIPetApi: public QObject { public: OAIPetApi(); - OAIPetApi(const QString& host, const QString& basePath); + OAIPetApi(const QString& host, const QString& basePath, const int toutMs = 0); ~OAIPetApi(); void setBasePath(const QString& basePath); void setHost(const QString& host); + void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); void addPet(const OAIPet& body); @@ -48,6 +49,7 @@ public: private: QString basePath; QString host; + int timeout; QMap defaultHeaders; void addPetCallback (OAIHttpRequestWorker * worker); void deletePetCallback (OAIHttpRequestWorker * worker); @@ -77,23 +79,23 @@ signals: void updatePetWithFormSignalFull(OAIHttpRequestWorker* worker); void uploadFileSignalFull(OAIHttpRequestWorker* worker, OAIApiResponse summary); - void addPetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void deletePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByStatusSignalE(QList summary, QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByTagsSignalE(QList summary, QNetworkReply::NetworkError error_type, QString& error_str); - void getPetByIdSignalE(OAIPet summary, QNetworkReply::NetworkError error_type, QString& error_str); - void updatePetSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void uploadFileSignalE(OAIApiResponse summary, QNetworkReply::NetworkError error_type, QString& error_str); + void addPetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void deletePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByStatusSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByTagsSignalE(QList summary, QNetworkReply::NetworkError error_type, QString error_str); + void getPetByIdSignalE(OAIPet summary, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void updatePetWithFormSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void uploadFileSignalE(OAIApiResponse summary, QNetworkReply::NetworkError error_type, QString error_str); - void addPetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void deletePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByStatusSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void findPetsByTagsSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void getPetByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void updatePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void updatePetWithFormSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void uploadFileSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void addPetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void deletePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByStatusSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void findPetsByTagsSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getPetByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updatePetWithFormSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void uploadFileSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); }; diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp index e83f7f5139e..90ac22d129f 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.cpp @@ -19,7 +19,8 @@ namespace OpenAPI { OAIStoreApi::OAIStoreApi() : basePath("/v2"), - host("petstore.swagger.io") { + host("petstore.swagger.io"), + timeout(0){ } @@ -27,9 +28,10 @@ OAIStoreApi::~OAIStoreApi() { } -OAIStoreApi::OAIStoreApi(const QString& host, const QString& basePath) { +OAIStoreApi::OAIStoreApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; + this->timeout = tout; } void OAIStoreApi::setBasePath(const QString& basePath){ @@ -40,6 +42,10 @@ void OAIStoreApi::setHost(const QString& host){ this->host = host; } +void OAIStoreApi::setApiTimeOutMs(const int tout){ + timeout = tout; +} + void OAIStoreApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } @@ -54,6 +60,7 @@ OAIStoreApi::deleteOrder(const QString& order_id) { fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "DELETE"); @@ -98,6 +105,7 @@ OAIStoreApi::getInventory() { fullPath.append(this->host).append(this->basePath).append("/store/inventory"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -155,6 +163,7 @@ OAIStoreApi::getOrderById(const qint64& order_id) { fullPath.replace(order_idPathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(order_id))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -200,6 +209,7 @@ OAIStoreApi::placeOrder(const OAIOrder& body) { fullPath.append(this->host).append(this->basePath).append("/store/order"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); diff --git a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h index 62bba015a36..e532321dcd8 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIStoreApi.h @@ -28,11 +28,12 @@ class OAIStoreApi: public QObject { public: OAIStoreApi(); - OAIStoreApi(const QString& host, const QString& basePath); + OAIStoreApi(const QString& host, const QString& basePath, const int toutMs = 0); ~OAIStoreApi(); void setBasePath(const QString& basePath); void setHost(const QString& host); + void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); void deleteOrder(const QString& order_id); @@ -43,6 +44,7 @@ public: private: QString basePath; QString host; + int timeout; QMap defaultHeaders; void deleteOrderCallback (OAIHttpRequestWorker * worker); void getInventoryCallback (OAIHttpRequestWorker * worker); @@ -60,15 +62,15 @@ signals: void getOrderByIdSignalFull(OAIHttpRequestWorker* worker, OAIOrder summary); void placeOrderSignalFull(OAIHttpRequestWorker* worker, OAIOrder summary); - void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void getInventorySignalE(QMap summary, QNetworkReply::NetworkError error_type, QString& error_str); - void getOrderByIdSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString& error_str); - void placeOrderSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString& error_str); + void deleteOrderSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void getInventorySignalE(QMap summary, QNetworkReply::NetworkError error_type, QString error_str); + void getOrderByIdSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString error_str); + void placeOrderSignalE(OAIOrder summary, QNetworkReply::NetworkError error_type, QString error_str); - void deleteOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void getInventorySignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void getOrderByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void placeOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void deleteOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getInventorySignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getOrderByIdSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void placeOrderSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); }; diff --git a/samples/client/petstore/cpp-qt5/client/OAITag.h b/samples/client/petstore/cpp-qt5/client/OAITag.h index 2a497cf1bd7..497a021f085 100644 --- a/samples/client/petstore/cpp-qt5/client/OAITag.h +++ b/samples/client/petstore/cpp-qt5/client/OAITag.h @@ -68,4 +68,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAITag) + #endif // OAITag_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIUser.h b/samples/client/petstore/cpp-qt5/client/OAIUser.h index d388f62a29b..556de322584 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUser.h +++ b/samples/client/petstore/cpp-qt5/client/OAIUser.h @@ -116,4 +116,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIUser) + #endif // OAIUser_H diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp b/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp index 79731867df9..36a418994f9 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp +++ b/samples/client/petstore/cpp-qt5/client/OAIUserApi.cpp @@ -19,7 +19,8 @@ namespace OpenAPI { OAIUserApi::OAIUserApi() : basePath("/v2"), - host("petstore.swagger.io") { + host("petstore.swagger.io"), + timeout(0){ } @@ -27,9 +28,10 @@ OAIUserApi::~OAIUserApi() { } -OAIUserApi::OAIUserApi(const QString& host, const QString& basePath) { +OAIUserApi::OAIUserApi(const QString& host, const QString& basePath, const int tout) { this->host = host; this->basePath = basePath; + this->timeout = tout; } void OAIUserApi::setBasePath(const QString& basePath){ @@ -40,6 +42,10 @@ void OAIUserApi::setHost(const QString& host){ this->host = host; } +void OAIUserApi::setApiTimeOutMs(const int tout){ + timeout = tout; +} + void OAIUserApi::addHeaders(const QString& key, const QString& value){ defaultHeaders.insert(key, value); } @@ -51,6 +57,7 @@ OAIUserApi::createUser(const OAIUser& body) { fullPath.append(this->host).append(this->basePath).append("/user"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); @@ -99,6 +106,7 @@ OAIUserApi::createUsersWithArrayInput(const QList& body) { fullPath.append(this->host).append(this->basePath).append("/user/createWithArray"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); @@ -148,6 +156,7 @@ OAIUserApi::createUsersWithListInput(const QList& body) { fullPath.append(this->host).append(this->basePath).append("/user/createWithList"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "POST"); @@ -200,6 +209,7 @@ OAIUserApi::deleteUser(const QString& username) { fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "DELETE"); @@ -247,6 +257,7 @@ OAIUserApi::getUserByName(const QString& username) { fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -308,6 +319,7 @@ OAIUserApi::loginUser(const QString& username, const QString& password) { .append(QUrl::toPercentEncoding(::OpenAPI::toStringValue(password))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -354,6 +366,7 @@ OAIUserApi::logoutUser() { fullPath.append(this->host).append(this->basePath).append("/user/logout"); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "GET"); @@ -401,6 +414,7 @@ OAIUserApi::updateUser(const QString& username, const OAIUser& body) { fullPath.replace(usernamePathParam, QUrl::toPercentEncoding(::OpenAPI::toStringValue(username))); OAIHttpRequestWorker *worker = new OAIHttpRequestWorker(); + worker->setTimeOut(timeout); OAIHttpRequestInput input(fullPath, "PUT"); diff --git a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h b/samples/client/petstore/cpp-qt5/client/OAIUserApi.h index 1f858bad947..d95814e0710 100644 --- a/samples/client/petstore/cpp-qt5/client/OAIUserApi.h +++ b/samples/client/petstore/cpp-qt5/client/OAIUserApi.h @@ -28,11 +28,12 @@ class OAIUserApi: public QObject { public: OAIUserApi(); - OAIUserApi(const QString& host, const QString& basePath); + OAIUserApi(const QString& host, const QString& basePath, const int toutMs = 0); ~OAIUserApi(); void setBasePath(const QString& basePath); void setHost(const QString& host); + void setApiTimeOutMs(const int tout); void addHeaders(const QString& key, const QString& value); void createUser(const OAIUser& body); @@ -47,6 +48,7 @@ public: private: QString basePath; QString host; + int timeout; QMap defaultHeaders; void createUserCallback (OAIHttpRequestWorker * worker); void createUsersWithArrayInputCallback (OAIHttpRequestWorker * worker); @@ -76,23 +78,23 @@ signals: void logoutUserSignalFull(OAIHttpRequestWorker* worker); void updateUserSignalFull(OAIHttpRequestWorker* worker); - void createUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void getUserByNameSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString& error_str); - void loginUserSignalE(QString summary, QNetworkReply::NetworkError error_type, QString& error_str); - void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); - void updateUserSignalE(QNetworkReply::NetworkError error_type, QString& error_str); + void createUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithArrayInputSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithListInputSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void deleteUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void getUserByNameSignalE(OAIUser summary, QNetworkReply::NetworkError error_type, QString error_str); + void loginUserSignalE(QString summary, QNetworkReply::NetworkError error_type, QString error_str); + void logoutUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); + void updateUserSignalE(QNetworkReply::NetworkError error_type, QString error_str); - void createUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void createUsersWithArrayInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void createUsersWithListInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void deleteUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void getUserByNameSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void loginUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void logoutUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); - void updateUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString& error_str); + void createUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithArrayInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void createUsersWithListInputSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void deleteUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void getUserByNameSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void loginUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void logoutUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); + void updateUserSignalEFull(OAIHttpRequestWorker* worker, QNetworkReply::NetworkError error_type, QString error_str); }; diff --git a/samples/client/petstore/cpp-restsdk/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/CMakeLists.txt index 6c7bfafe813..6aec7474b59 100644 --- a/samples/client/petstore/cpp-restsdk/CMakeLists.txt +++ b/samples/client/petstore/cpp-restsdk/CMakeLists.txt @@ -1,54 +1,37 @@ -# -# OpenAPI Petstore -# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. -# -# OpenAPI spec version: 1.0.0 -# -# https://openapi-generator.tech -# -# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). +cmake_minimum_required (VERSION 3.2) -cmake_minimum_required (VERSION 2.8) - -#PROJECT's NAME -project(CppRestOpenAPIClient) +project(cpprest-petstore) +set(CMAKE_VERBOSE_MAKEFILE ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) -# THE LOCATION OF OUTPUT BINARIES -set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) -set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -Wall -Wno-unused-variable") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -g3") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -g3") +set(CMAKE_BUILD_TYPE Debug) +set(CMAKE_PREFIX_PATH /usr/lib/x86_64-linux-gnu/cmake) +find_package(cpprestsdk REQUIRED) +find_package(Boost REQUIRED) +add_subdirectory(client) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() +file(GLOB SRCS + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) +include_directories( + ${CMAKE_CURRENT_SOURCE_DIR}/client + ${CMAKE_CURRENT_SOURCE_DIR}/client/model + ${CMAKE_CURRENT_SOURCE_DIR}/client/api +) -# BUILD TYPE -message("A ${CMAKE_BUILD_TYPE} build configuration is detected") +link_directories( + ${Boost_LIBRARY_DIRS} +) +add_executable(${PROJECT_NAME} ${SRCS}) +add_dependencies(${PROJECT_NAME} CppRestOpenAPIClient ) +target_link_libraries(${PROJECT_NAME} CppRestOpenAPIClient cpprest pthread boost_system crypto) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) -# Update require components as necessary -#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) - -# build and set path to cpp rest sdk -set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/3rdParty/cpprest) -set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) -set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) - -include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) - - -# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it. -# To install required vcpkg packages execute: -# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows -# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows") -# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include) -# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib) -# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR}) - -#SUPPORTING FILES -set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") -#SOURCE FILES -file(GLOB SOURCE_FILES "api/*" "model/*") - -add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) diff --git a/samples/client/petstore/cpp-restsdk/PetApiTests.cpp b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp new file mode 100644 index 00000000000..c8a1bdad1a0 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/PetApiTests.cpp @@ -0,0 +1,92 @@ +#include "PetApiTests.h" +#include +#include +#include +#include + +OAIPetApiTests::OAIPetApiTests(std::string host, std::string basePath){ + apiconfiguration = std::make_shared(); + apiconfiguration->setBaseUrl(host + basePath); + apiconfiguration->setUserAgent(U("OpenAPI Client")); + apiclient = std::make_shared(apiconfiguration); + api = std::make_shared(apiclient); +} + +OAIPetApiTests::~OAIPetApiTests() { + +} + +void OAIPetApiTests::runTests(){ + testAddPet(); + testFindPetsByStatus(); + testGetPetById(); +} + +void OAIPetApiTests::testAddPet(){ + auto req = std::make_shared(); + req->setId(12345); + req->setName("cpprest-pet"); + req->setStatus(U("123")); + + std::function responseCallback = []() + { + std::cout << "added pet successfully" << std::endl; + }; + + auto reqTask = api->addPet(req).then(responseCallback); + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::testFindPetsByStatus(){ + auto req = std::vector(); + req.push_back(U("123")); + auto reqTask = api->findPetsByStatus(req) + .then([=](std::vector> pets) + { + std::cout << "found pet successfully" << std::endl; + }); + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::testGetPetById(){ + int req = 12345; + auto responseCallback = std::bind(&OAIPetApiTests::getPetByIdCallback, this, std::placeholders::_1); + + auto reqTask = api->getPetById(req).then(responseCallback); + + try{ + reqTask.wait(); + } + catch(const ApiException& ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } + catch(const std::exception &ex){ + std::cout << ex.what() << std::endl << std::flush; + std::string err(ex.what()); + } +} + +void OAIPetApiTests::getPetByIdCallback(std::shared_ptr pet){ + std::cout << "found pet by id successfully" << std::endl; +} diff --git a/samples/client/petstore/cpp-restsdk/PetApiTests.h b/samples/client/petstore/cpp-restsdk/PetApiTests.h new file mode 100644 index 00000000000..7727a6437fd --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/PetApiTests.h @@ -0,0 +1,34 @@ +#ifndef OAI_PETAPI_TESTS_H +#define OAI_PETAPI_TESTS_H + +#include +#include "client/ApiClient.h" +#include "client/ApiConfiguration.h" +#include "client/api/PetApi.h" +#include "client/model/Pet.h" + + +using namespace std; +using namespace org::openapitools::client::api; + +class OAIPetApiTests +{ +public: + explicit OAIPetApiTests(std::string host = U("http://petstore.swagger.io"), std::string basePath = U("/v2")); + + virtual ~OAIPetApiTests(); +public: + void runTests(); +private: + void testAddPet(); + void testFindPetsByStatus(); + void testGetPetById(); + + void getPetByIdCallback(std::shared_ptr pet); + + std::shared_ptr apiconfiguration; + std::shared_ptr apiclient; + std::shared_ptr api; +}; + +#endif // OAI_PETAPI_TESTS_H diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.cpp b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/ApiClient.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiClient.cpp index f9445bd20c6..384eb8a8bc5 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiClient.h b/samples/client/petstore/cpp-restsdk/client/ApiClient.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/ApiClient.h rename to samples/client/petstore/cpp-restsdk/client/ApiClient.h index 2e34724d596..5c5d78c765e 100644 --- a/samples/client/petstore/cpp-restsdk/ApiClient.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiClient.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp similarity index 93% rename from samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp index 531320239fb..251b0d0d299 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/ApiConfiguration.h rename to samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h index d89fea879e4..f6f35205990 100644 --- a/samples/client/petstore/cpp-restsdk/ApiConfiguration.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiConfiguration.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.cpp b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp similarity index 91% rename from samples/client/petstore/cpp-restsdk/ApiException.cpp rename to samples/client/petstore/cpp-restsdk/client/ApiException.cpp index 124bf391142..b0a637cf600 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ApiException.h b/samples/client/petstore/cpp-restsdk/client/ApiException.h similarity index 92% rename from samples/client/petstore/cpp-restsdk/ApiException.h rename to samples/client/petstore/cpp-restsdk/client/ApiException.h index d419f13f3dd..30f5ef51df3 100644 --- a/samples/client/petstore/cpp-restsdk/ApiException.h +++ b/samples/client/petstore/cpp-restsdk/client/ApiException.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt new file mode 100644 index 00000000000..86565fec65e --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/CMakeLists.txt @@ -0,0 +1,54 @@ +# +# OpenAPI Petstore +# This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +# +# The version of the OpenAPI document: 1.0.0 +# +# https://openapi-generator.tech +# +# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech). + +cmake_minimum_required (VERSION 2.8) + +#PROJECT's NAME +project(CppRestOpenAPIClient) + + +# THE LOCATION OF OUTPUT BINARIES +set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib) +set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_DIR}) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + +# BUILD TYPE +message("A ${CMAKE_BUILD_TYPE} build configuration is detected") + +# Update require components as necessary +#find_package(Boost 1.45.0 REQUIRED COMPONENTS ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_DATE_TIME_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}) + +# build and set path to cpp rest sdk +set(CPPREST_ROOT ${PROJECT_SOURCE_DIR}/3rdParty/cpprest) +set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include) +set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib) + +include_directories(${PROJECT_SOURCE_DIR} api model ${CPPREST_INCLUDE_DIR}) + + +# If using vcpkg, set include directories. Also comment out CPPREST section above since vcpkg will handle it. +# To install required vcpkg packages execute: +# > vcpkg install cpprestsdk cpprestsdk:x64-windows boost-uuid boost-uuid:x64-windows +# set(VCPKG_ROOT "C:\\vcpkg\\installed\\x64-windows") +# set(VCPKG_INCLUDE_DIR ${VCPKG_ROOT}/include) +# set(VCPKG_LIBRARY_DIR ${VCPKG_ROOT}/lib) +# include_directories(${PROJECT_SOURCE_DIR} api model ${VCPKG_INCLUDE_DIR}) + +#SUPPORTING FILES +set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object") +#SOURCE FILES +file(GLOB SOURCE_FILES "api/*" "model/*") + +add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES}) diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.cpp b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp similarity index 92% rename from samples/client/petstore/cpp-restsdk/HttpContent.cpp rename to samples/client/petstore/cpp-restsdk/client/HttpContent.cpp index 0c0cce5fcdd..6dedcd29908 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.cpp +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/HttpContent.h b/samples/client/petstore/cpp-restsdk/client/HttpContent.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/HttpContent.h rename to samples/client/petstore/cpp-restsdk/client/HttpContent.h index 25dd1d5c6e0..b357475da38 100644 --- a/samples/client/petstore/cpp-restsdk/HttpContent.h +++ b/samples/client/petstore/cpp-restsdk/client/HttpContent.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/IHttpBody.h b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h similarity index 87% rename from samples/client/petstore/cpp-restsdk/IHttpBody.h rename to samples/client/petstore/cpp-restsdk/client/IHttpBody.h index 07d0e5c84ce..865bd467f30 100644 --- a/samples/client/petstore/cpp-restsdk/IHttpBody.h +++ b/samples/client/petstore/cpp-restsdk/client/IHttpBody.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.cpp b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp similarity index 83% rename from samples/client/petstore/cpp-restsdk/JsonBody.cpp rename to samples/client/petstore/cpp-restsdk/client/JsonBody.cpp index b523ba6f67c..e2edc1b67ef 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.cpp +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/JsonBody.h b/samples/client/petstore/cpp-restsdk/client/JsonBody.h similarity index 88% rename from samples/client/petstore/cpp-restsdk/JsonBody.h rename to samples/client/petstore/cpp-restsdk/client/JsonBody.h index dacf42985c9..fba123dfc42 100644 --- a/samples/client/petstore/cpp-restsdk/JsonBody.h +++ b/samples/client/petstore/cpp-restsdk/client/JsonBody.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.cpp b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/ModelBase.cpp rename to samples/client/petstore/cpp-restsdk/client/ModelBase.cpp index ec9192c14e2..8b9f859dd6e 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.cpp +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/ModelBase.h similarity index 98% rename from samples/client/petstore/cpp-restsdk/ModelBase.h rename to samples/client/petstore/cpp-restsdk/client/ModelBase.h index 80e8a76edbf..26459aa5895 100644 --- a/samples/client/petstore/cpp-restsdk/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/ModelBase.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/MultipartFormData.cpp rename to samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp index fda5c805bdd..ec6af2de5e0 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.cpp +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/MultipartFormData.h b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/MultipartFormData.h rename to samples/client/petstore/cpp-restsdk/client/MultipartFormData.h index cff61c6cb5c..96d8c3a662a 100644 --- a/samples/client/petstore/cpp-restsdk/MultipartFormData.h +++ b/samples/client/petstore/cpp-restsdk/client/MultipartFormData.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/Object.cpp b/samples/client/petstore/cpp-restsdk/client/Object.cpp similarity index 94% rename from samples/client/petstore/cpp-restsdk/Object.cpp rename to samples/client/petstore/cpp-restsdk/client/Object.cpp index a63e69cea48..3624e24a017 100644 --- a/samples/client/petstore/cpp-restsdk/Object.cpp +++ b/samples/client/petstore/cpp-restsdk/client/Object.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/Object.h b/samples/client/petstore/cpp-restsdk/client/Object.h similarity index 92% rename from samples/client/petstore/cpp-restsdk/Object.h rename to samples/client/petstore/cpp-restsdk/client/Object.h index 99179be55bd..bc2c7aa7573 100644 --- a/samples/client/petstore/cpp-restsdk/Object.h +++ b/samples/client/petstore/cpp-restsdk/client/Object.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/README.md b/samples/client/petstore/cpp-restsdk/client/README.md similarity index 100% rename from samples/client/petstore/cpp-restsdk/README.md rename to samples/client/petstore/cpp-restsdk/client/README.md diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/PetApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp index d8530e324c0..0c67b5ecbf5 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/PetApi.h b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h similarity index 97% rename from samples/client/petstore/cpp-restsdk/api/PetApi.h rename to samples/client/petstore/cpp-restsdk/client/api/PetApi.h index bb7b6f7b199..09b2f06da9b 100644 --- a/samples/client/petstore/cpp-restsdk/api/PetApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/PetApi.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/StoreApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp index 0ec396c54e4..a7bcf614ee2 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h similarity index 95% rename from samples/client/petstore/cpp-restsdk/api/StoreApi.h rename to samples/client/petstore/cpp-restsdk/client/api/StoreApi.h index 700f788df27..2aaf9bf5969 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/StoreApi.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp similarity index 99% rename from samples/client/petstore/cpp-restsdk/api/UserApi.cpp rename to samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp index ba8769d344a..a4c4f1bf462 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/api/UserApi.h rename to samples/client/petstore/cpp-restsdk/client/api/UserApi.h index fc76cfc9177..aa840cf1f90 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/client/api/UserApi.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/git_push.sh b/samples/client/petstore/cpp-restsdk/client/git_push.sh similarity index 100% rename from samples/client/petstore/cpp-restsdk/git_push.sh rename to samples/client/petstore/cpp-restsdk/client/git_push.sh diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp similarity index 97% rename from samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp rename to samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp index 4122b863fb6..3fa6061fb04 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h similarity index 94% rename from samples/client/petstore/cpp-restsdk/model/ApiResponse.h rename to samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h index 83115c794ab..9b1d7abc1a7 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/client/model/ApiResponse.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.cpp b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Category.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Category.cpp index ad6422cb906..8d21469964c 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.h b/samples/client/petstore/cpp-restsdk/client/model/Category.h similarity index 94% rename from samples/client/petstore/cpp-restsdk/model/Category.h rename to samples/client/petstore/cpp-restsdk/client/model/Category.h index 026ec860728..1d425850a5b 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Category.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.cpp b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/Order.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Order.cpp index a15f779237c..e137a045fa6 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.h b/samples/client/petstore/cpp-restsdk/client/model/Order.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Order.h rename to samples/client/petstore/cpp-restsdk/client/model/Order.h index c5d4153cfcd..9d697587404 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Order.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/Pet.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Pet.cpp index 6e4ebb69c4d..76a39be3db6 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.h b/samples/client/petstore/cpp-restsdk/client/model/Pet.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Pet.h rename to samples/client/petstore/cpp-restsdk/client/model/Pet.h index 881685336df..3ebb80bf285 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Pet.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/Tag.cpp rename to samples/client/petstore/cpp-restsdk/client/model/Tag.cpp index 9f5f5b14636..a4af089387e 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.h b/samples/client/petstore/cpp-restsdk/client/model/Tag.h similarity index 93% rename from samples/client/petstore/cpp-restsdk/model/Tag.h rename to samples/client/petstore/cpp-restsdk/client/model/Tag.h index 9df0f2c2e7e..db92cc2549c 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/client/model/Tag.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.cpp b/samples/client/petstore/cpp-restsdk/client/model/User.cpp similarity index 98% rename from samples/client/petstore/cpp-restsdk/model/User.cpp rename to samples/client/petstore/cpp-restsdk/client/model/User.cpp index 93a64fbb360..8ffd2ea50d0 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/client/model/User.cpp @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.h b/samples/client/petstore/cpp-restsdk/client/model/User.h similarity index 96% rename from samples/client/petstore/cpp-restsdk/model/User.h rename to samples/client/petstore/cpp-restsdk/client/model/User.h index 851dcc57a25..e3a970cb4df 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.h +++ b/samples/client/petstore/cpp-restsdk/client/model/User.h @@ -2,9 +2,9 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 4.0.0-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 4.0.2-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/pom.xml b/samples/client/petstore/cpp-restsdk/client/pom.xml similarity index 100% rename from samples/client/petstore/cpp-restsdk/pom.xml rename to samples/client/petstore/cpp-restsdk/client/pom.xml diff --git a/samples/client/petstore/cpp-restsdk/main.cpp b/samples/client/petstore/cpp-restsdk/main.cpp new file mode 100644 index 00000000000..27ca41ceb64 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/main.cpp @@ -0,0 +1,6 @@ +#include "PetApiTests.h" + +int main(int argc, char *argv[]) { + auto petTest = std::make_shared(); + petTest->runTests(); +} diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md index 8e320736696..c2049be3127 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/README.md @@ -48,7 +48,7 @@ using Org.OpenAPITools.Model; ## Getting Started ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -58,10 +58,11 @@ namespace Example { public class Example { - public void main() + public static void Main() { - var apiInstance = new AnotherFakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -70,9 +71,11 @@ namespace Example ModelClient result = apiInstance.Call123TestSpecialTags(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/AnotherFakeApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/AnotherFakeApi.md index 612293b48bb..bf404a2f491 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/AnotherFakeApi.md @@ -17,7 +17,7 @@ To test special tags and operation ID starting with number ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -27,9 +27,10 @@ namespace Example { public class Call123TestSpecialTagsExample { - public void main() + public static void Main() { - var apiInstance = new AnotherFakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -38,9 +39,11 @@ namespace Example ModelClient result = apiInstance.Call123TestSpecialTags(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -66,5 +69,10 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeApi.md index 8a11d6461f2..0fd0f4dad71 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeApi.md @@ -29,7 +29,7 @@ this route creates an XmlItem ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -39,9 +39,10 @@ namespace Example { public class CreateXmlItemExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var xmlItem = new XmlItem(); // XmlItem | XmlItem Body try @@ -49,9 +50,11 @@ namespace Example // creates an XmlItem apiInstance.CreateXmlItem(xmlItem); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.CreateXmlItem: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -77,6 +80,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -89,7 +97,7 @@ Test serialization of outer boolean types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -99,9 +107,10 @@ namespace Example { public class FakeOuterBooleanSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = true; // bool? | Input boolean as post body (optional) try @@ -109,9 +118,11 @@ namespace Example bool result = apiInstance.FakeOuterBooleanSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -137,6 +148,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -149,7 +165,7 @@ Test serialization of object with outer number type ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -159,9 +175,10 @@ namespace Example { public class FakeOuterCompositeSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) try @@ -169,9 +186,11 @@ namespace Example OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -197,6 +216,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -209,7 +233,7 @@ Test serialization of outer number types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -219,9 +243,10 @@ namespace Example { public class FakeOuterNumberSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = 8.14; // decimal? | Input number as post body (optional) try @@ -229,9 +254,11 @@ namespace Example decimal result = apiInstance.FakeOuterNumberSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -257,6 +284,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -269,7 +301,7 @@ Test serialization of outer string types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -279,9 +311,10 @@ namespace Example { public class FakeOuterStringSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = body_example; // string | Input string as post body (optional) try @@ -289,9 +322,11 @@ namespace Example string result = apiInstance.FakeOuterStringSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -317,6 +352,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -329,7 +369,7 @@ For this test, the body for this request much reference a schema named `File`. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -339,18 +379,21 @@ namespace Example { public class TestBodyWithFileSchemaExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new FileSchemaTestClass(); // FileSchemaTestClass | try { apiInstance.TestBodyWithFileSchema(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -376,6 +419,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -386,7 +434,7 @@ No authorization required ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -396,9 +444,10 @@ namespace Example { public class TestBodyWithQueryParamsExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var query = query_example; // string | var body = new User(); // User | @@ -406,9 +455,11 @@ namespace Example { apiInstance.TestBodyWithQueryParams(query, body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -435,6 +486,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -447,7 +503,7 @@ To test \"client\" model ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -457,9 +513,10 @@ namespace Example { public class TestClientModelExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -468,9 +525,11 @@ namespace Example ModelClient result = apiInstance.TestClientModel(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -496,6 +555,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -508,7 +572,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -518,13 +582,14 @@ namespace Example { public class TestEndpointParametersExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure HTTP basic authorization: http_basic_test Configuration.Default.Username = "YOUR_USERNAME"; Configuration.Default.Password = "YOUR_PASSWORD"; - var apiInstance = new FakeApi(); + var apiInstance = new FakeApi(Configuration.Default); var number = 8.14; // decimal | None var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None @@ -545,9 +610,11 @@ namespace Example // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -586,6 +653,12 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -598,7 +671,7 @@ To test enum parameters ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -608,9 +681,10 @@ namespace Example { public class TestEnumParametersExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var enumHeaderStringArray = enumHeaderStringArray_example; // List | Header parameter enum test (string array) (optional) var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) @@ -625,9 +699,11 @@ namespace Example // To test enum parameters apiInstance.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -660,6 +736,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -672,7 +754,7 @@ Fake endpoint to test group parameters (optional) ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -682,9 +764,10 @@ namespace Example { public class TestGroupParametersExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters @@ -697,9 +780,11 @@ namespace Example // Fake endpoint to test group parameters (optional) apiInstance.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -730,6 +815,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -740,7 +830,7 @@ test inline additionalProperties ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -750,9 +840,10 @@ namespace Example { public class TestInlineAdditionalPropertiesExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var param = new Dictionary(); // Dictionary | request body try @@ -760,9 +851,11 @@ namespace Example // test inline additionalProperties apiInstance.TestInlineAdditionalProperties(param); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -788,6 +881,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -798,7 +896,7 @@ test json serialization of form data ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -808,9 +906,10 @@ namespace Example { public class TestJsonFormDataExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var param = param_example; // string | field1 var param2 = param2_example; // string | field2 @@ -819,9 +918,11 @@ namespace Example // test json serialization of form data apiInstance.TestJsonFormData(param, param2); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -848,5 +949,10 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeClassnameTags123Api.md index abea3cb9977..3a241e3c631 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/FakeClassnameTags123Api.md @@ -17,7 +17,7 @@ To test class name in snake case ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -27,14 +27,15 @@ namespace Example { public class TestClassnameExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key_query Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); - var apiInstance = new FakeClassnameTags123Api(); + var apiInstance = new FakeClassnameTags123Api(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -43,9 +44,11 @@ namespace Example ModelClient result = apiInstance.TestClassname(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -71,5 +74,10 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md index a7b361f05ab..f8d05ec9396 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/PetApi.md @@ -23,7 +23,7 @@ Add a new pet to the store ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -33,12 +33,13 @@ namespace Example { public class AddPetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var body = new Pet(); // Pet | Pet object that needs to be added to the store try @@ -46,9 +47,11 @@ namespace Example // Add a new pet to the store apiInstance.AddPet(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -74,6 +77,12 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -84,7 +93,7 @@ Deletes a pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -94,12 +103,13 @@ namespace Example { public class DeletePetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | Pet id to delete var apiKey = apiKey_example; // string | (optional) @@ -108,9 +118,11 @@ namespace Example // Deletes a pet apiInstance.DeletePet(petId, apiKey); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -137,11 +149,17 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **FindPetsByStatus** -> List FindPetsByStatus (List status) +> List<Pet> FindPetsByStatus (List status) Finds Pets by status @@ -149,7 +167,7 @@ Multiple status values can be provided with comma separated strings ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -159,23 +177,26 @@ namespace Example { public class FindPetsByStatusExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var status = status_example; // List | Status values that need to be considered for filter try { // Finds Pets by status - List<Pet> result = apiInstance.FindPetsByStatus(status); + List result = apiInstance.FindPetsByStatus(status); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -190,7 +211,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -201,11 +222,17 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **FindPetsByTags** -> List FindPetsByTags (List tags) +> List<Pet> FindPetsByTags (List tags) Finds Pets by tags @@ -213,7 +240,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -223,23 +250,26 @@ namespace Example { public class FindPetsByTagsExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var tags = new List(); // List | Tags to filter by try { // Finds Pets by tags - List<Pet> result = apiInstance.FindPetsByTags(tags); + List result = apiInstance.FindPetsByTags(tags); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -254,7 +284,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -265,6 +295,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -277,7 +313,7 @@ Returns a single pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -287,14 +323,15 @@ namespace Example { public class GetPetByIdExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to return try @@ -303,9 +340,11 @@ namespace Example Pet result = apiInstance.GetPetById(petId); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -331,6 +370,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -341,7 +387,7 @@ Update an existing pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -351,12 +397,13 @@ namespace Example { public class UpdatePetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var body = new Pet(); // Pet | Pet object that needs to be added to the store try @@ -364,9 +411,11 @@ namespace Example // Update an existing pet apiInstance.UpdatePet(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -392,6 +441,14 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -402,7 +459,7 @@ Updates a pet in the store with form data ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -412,12 +469,13 @@ namespace Example { public class UpdatePetWithFormExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet that needs to be updated var name = name_example; // string | Updated name of the pet (optional) var status = status_example; // string | Updated status of the pet (optional) @@ -427,9 +485,11 @@ namespace Example // Updates a pet in the store with form data apiInstance.UpdatePetWithForm(petId, name, status); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -457,6 +517,11 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -467,7 +532,7 @@ uploads an image ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -477,12 +542,13 @@ namespace Example { public class UploadFileExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to update var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) var file = BINARY_DATA_HERE; // System.IO.Stream | file to upload (optional) @@ -493,9 +559,11 @@ namespace Example ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -523,6 +591,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -533,7 +606,7 @@ uploads an image (required) ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -543,12 +616,13 @@ namespace Example { public class UploadFileWithRequiredFileExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to update var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) @@ -559,9 +633,11 @@ namespace Example ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -589,5 +665,10 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/StoreApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/StoreApi.md index 947a0304ce8..c5143852603 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/StoreApi.md @@ -20,7 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -30,9 +30,10 @@ namespace Example { public class DeleteOrderExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var orderId = orderId_example; // string | ID of the order that needs to be deleted try @@ -40,9 +41,11 @@ namespace Example // Delete purchase order by ID apiInstance.DeleteOrder(orderId); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -68,11 +71,17 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetInventory** -> Dictionary GetInventory () +> Dictionary<string, int> GetInventory () Returns pet inventories by status @@ -80,7 +89,7 @@ Returns a map of status codes to quantities ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -90,24 +99,27 @@ namespace Example { public class GetInventoryExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); - var apiInstance = new StoreApi(); + var apiInstance = new StoreApi(Configuration.Default); try { // Returns pet inventories by status - Dictionary<string, int> result = apiInstance.GetInventory(); + Dictionary result = apiInstance.GetInventory(); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -130,6 +142,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -142,7 +159,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -152,9 +169,10 @@ namespace Example { public class GetOrderByIdExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var orderId = 789; // long | ID of pet that needs to be fetched try @@ -163,9 +181,11 @@ namespace Example Order result = apiInstance.GetOrderById(orderId); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -191,6 +211,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -201,7 +228,7 @@ Place an order for a pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -211,9 +238,10 @@ namespace Example { public class PlaceOrderExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var body = new Order(); // Order | order placed for purchasing the pet try @@ -222,9 +250,11 @@ namespace Example Order result = apiInstance.PlaceOrder(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -250,5 +280,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md index 9a535e16a82..4588b440131 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClient/docs/UserApi.md @@ -24,7 +24,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -34,9 +34,10 @@ namespace Example { public class CreateUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new User(); // User | Created user object try @@ -44,9 +45,11 @@ namespace Example // Create user apiInstance.CreateUser(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -72,6 +75,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -82,7 +90,7 @@ Creates list of users with given input array ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -92,9 +100,10 @@ namespace Example { public class CreateUsersWithArrayInputExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new List(); // List | List of user object try @@ -102,9 +111,11 @@ namespace Example // Creates list of users with given input array apiInstance.CreateUsersWithArrayInput(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -115,7 +126,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -130,6 +141,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -140,7 +156,7 @@ Creates list of users with given input array ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -150,9 +166,10 @@ namespace Example { public class CreateUsersWithListInputExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new List(); // List | List of user object try @@ -160,9 +177,11 @@ namespace Example // Creates list of users with given input array apiInstance.CreateUsersWithListInput(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -173,7 +192,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -188,6 +207,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -200,7 +224,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -210,9 +234,10 @@ namespace Example { public class DeleteUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The name that needs to be deleted try @@ -220,9 +245,11 @@ namespace Example // Delete user apiInstance.DeleteUser(username); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -248,6 +275,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -258,7 +291,7 @@ Get user by user name ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -268,9 +301,10 @@ namespace Example { public class GetUserByNameExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. try @@ -279,9 +313,11 @@ namespace Example User result = apiInstance.GetUserByName(username); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -307,6 +343,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -317,7 +360,7 @@ Logs user into the system ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -327,9 +370,10 @@ namespace Example { public class LoginUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The user name for login var password = password_example; // string | The password for login in clear text @@ -339,9 +383,11 @@ namespace Example string result = apiInstance.LoginUser(username, password); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -368,6 +414,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -378,7 +430,7 @@ Logs out current logged in user session ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -388,18 +440,21 @@ namespace Example { public class LogoutUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); try { // Logs out current logged in user session apiInstance.LogoutUser(); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -422,6 +477,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -434,7 +494,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -444,9 +504,10 @@ namespace Example { public class UpdateUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | name that need to be deleted var body = new User(); // User | Updated user object @@ -455,9 +516,11 @@ namespace Example // Updated user apiInstance.UpdateUser(username, body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -484,5 +547,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md index bd485a13cd1..8ed98381bee 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/README.md @@ -60,7 +60,7 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p ## Getting Started ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -70,10 +70,11 @@ namespace Example { public class Example { - public void main() + public static void Main() { - var apiInstance = new AnotherFakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -82,9 +83,11 @@ namespace Example ModelClient result = apiInstance.Call123TestSpecialTags(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/AnotherFakeApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/AnotherFakeApi.md index 612293b48bb..bf404a2f491 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/AnotherFakeApi.md @@ -17,7 +17,7 @@ To test special tags and operation ID starting with number ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -27,9 +27,10 @@ namespace Example { public class Call123TestSpecialTagsExample { - public void main() + public static void Main() { - var apiInstance = new AnotherFakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new AnotherFakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -38,9 +39,11 @@ namespace Example ModelClient result = apiInstance.Call123TestSpecialTags(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -66,5 +69,10 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeApi.md index 8a11d6461f2..0fd0f4dad71 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeApi.md @@ -29,7 +29,7 @@ this route creates an XmlItem ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -39,9 +39,10 @@ namespace Example { public class CreateXmlItemExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var xmlItem = new XmlItem(); // XmlItem | XmlItem Body try @@ -49,9 +50,11 @@ namespace Example // creates an XmlItem apiInstance.CreateXmlItem(xmlItem); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.CreateXmlItem: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -77,6 +80,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -89,7 +97,7 @@ Test serialization of outer boolean types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -99,9 +107,10 @@ namespace Example { public class FakeOuterBooleanSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = true; // bool? | Input boolean as post body (optional) try @@ -109,9 +118,11 @@ namespace Example bool result = apiInstance.FakeOuterBooleanSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -137,6 +148,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -149,7 +165,7 @@ Test serialization of object with outer number type ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -159,9 +175,10 @@ namespace Example { public class FakeOuterCompositeSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) try @@ -169,9 +186,11 @@ namespace Example OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -197,6 +216,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -209,7 +233,7 @@ Test serialization of outer number types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -219,9 +243,10 @@ namespace Example { public class FakeOuterNumberSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = 8.14; // decimal? | Input number as post body (optional) try @@ -229,9 +254,11 @@ namespace Example decimal result = apiInstance.FakeOuterNumberSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -257,6 +284,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -269,7 +301,7 @@ Test serialization of outer string types ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -279,9 +311,10 @@ namespace Example { public class FakeOuterStringSerializeExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = body_example; // string | Input string as post body (optional) try @@ -289,9 +322,11 @@ namespace Example string result = apiInstance.FakeOuterStringSerialize(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -317,6 +352,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -329,7 +369,7 @@ For this test, the body for this request much reference a schema named `File`. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -339,18 +379,21 @@ namespace Example { public class TestBodyWithFileSchemaExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new FileSchemaTestClass(); // FileSchemaTestClass | try { apiInstance.TestBodyWithFileSchema(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -376,6 +419,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -386,7 +434,7 @@ No authorization required ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -396,9 +444,10 @@ namespace Example { public class TestBodyWithQueryParamsExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var query = query_example; // string | var body = new User(); // User | @@ -406,9 +455,11 @@ namespace Example { apiInstance.TestBodyWithQueryParams(query, body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestBodyWithQueryParams: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -435,6 +486,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -447,7 +503,7 @@ To test \"client\" model ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -457,9 +513,10 @@ namespace Example { public class TestClientModelExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -468,9 +525,11 @@ namespace Example ModelClient result = apiInstance.TestClientModel(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -496,6 +555,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -508,7 +572,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -518,13 +582,14 @@ namespace Example { public class TestEndpointParametersExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure HTTP basic authorization: http_basic_test Configuration.Default.Username = "YOUR_USERNAME"; Configuration.Default.Password = "YOUR_PASSWORD"; - var apiInstance = new FakeApi(); + var apiInstance = new FakeApi(Configuration.Default); var number = 8.14; // decimal | None var _double = 1.2D; // double | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None @@ -545,9 +610,11 @@ namespace Example // Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 apiInstance.TestEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, _string, binary, date, dateTime, password, callback); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -586,6 +653,12 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -598,7 +671,7 @@ To test enum parameters ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -608,9 +681,10 @@ namespace Example { public class TestEnumParametersExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var enumHeaderStringArray = enumHeaderStringArray_example; // List | Header parameter enum test (string array) (optional) var enumHeaderString = enumHeaderString_example; // string | Header parameter enum test (string) (optional) (default to -efg) var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) @@ -625,9 +699,11 @@ namespace Example // To test enum parameters apiInstance.TestEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestEnumParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -660,6 +736,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -672,7 +754,7 @@ Fake endpoint to test group parameters (optional) ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -682,9 +764,10 @@ namespace Example { public class TestGroupParametersExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var requiredStringGroup = 56; // int | Required String in group parameters var requiredBooleanGroup = true; // bool | Required Boolean in group parameters var requiredInt64Group = 789; // long | Required Integer in group parameters @@ -697,9 +780,11 @@ namespace Example // Fake endpoint to test group parameters (optional) apiInstance.TestGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestGroupParameters: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -730,6 +815,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -740,7 +830,7 @@ test inline additionalProperties ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -750,9 +840,10 @@ namespace Example { public class TestInlineAdditionalPropertiesExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var param = new Dictionary(); // Dictionary | request body try @@ -760,9 +851,11 @@ namespace Example // test inline additionalProperties apiInstance.TestInlineAdditionalProperties(param); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestInlineAdditionalProperties: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -788,6 +881,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -798,7 +896,7 @@ test json serialization of form data ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -808,9 +906,10 @@ namespace Example { public class TestJsonFormDataExample { - public void main() + public static void Main() { - var apiInstance = new FakeApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new FakeApi(Configuration.Default); var param = param_example; // string | field1 var param2 = param2_example; // string | field2 @@ -819,9 +918,11 @@ namespace Example // test json serialization of form data apiInstance.TestJsonFormData(param, param2); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeApi.TestJsonFormData: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -848,5 +949,10 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeClassnameTags123Api.md index abea3cb9977..3a241e3c631 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/FakeClassnameTags123Api.md @@ -17,7 +17,7 @@ To test class name in snake case ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -27,14 +27,15 @@ namespace Example { public class TestClassnameExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key_query Configuration.Default.AddApiKey("api_key_query", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key_query", "Bearer"); - var apiInstance = new FakeClassnameTags123Api(); + var apiInstance = new FakeClassnameTags123Api(Configuration.Default); var body = new ModelClient(); // ModelClient | client model try @@ -43,9 +44,11 @@ namespace Example ModelClient result = apiInstance.TestClassname(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling FakeClassnameTags123Api.TestClassname: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -71,5 +74,10 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md index a7b361f05ab..f8d05ec9396 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/PetApi.md @@ -23,7 +23,7 @@ Add a new pet to the store ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -33,12 +33,13 @@ namespace Example { public class AddPetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var body = new Pet(); // Pet | Pet object that needs to be added to the store try @@ -46,9 +47,11 @@ namespace Example // Add a new pet to the store apiInstance.AddPet(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -74,6 +77,12 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -84,7 +93,7 @@ Deletes a pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -94,12 +103,13 @@ namespace Example { public class DeletePetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | Pet id to delete var apiKey = apiKey_example; // string | (optional) @@ -108,9 +118,11 @@ namespace Example // Deletes a pet apiInstance.DeletePet(petId, apiKey); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -137,11 +149,17 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **FindPetsByStatus** -> List FindPetsByStatus (List status) +> List<Pet> FindPetsByStatus (List status) Finds Pets by status @@ -149,7 +167,7 @@ Multiple status values can be provided with comma separated strings ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -159,23 +177,26 @@ namespace Example { public class FindPetsByStatusExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var status = status_example; // List | Status values that need to be considered for filter try { // Finds Pets by status - List<Pet> result = apiInstance.FindPetsByStatus(status); + List result = apiInstance.FindPetsByStatus(status); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -190,7 +211,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -201,11 +222,17 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **FindPetsByTags** -> List FindPetsByTags (List tags) +> List<Pet> FindPetsByTags (List tags) Finds Pets by tags @@ -213,7 +240,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -223,23 +250,26 @@ namespace Example { public class FindPetsByTagsExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var tags = new List(); // List | Tags to filter by try { // Finds Pets by tags - List<Pet> result = apiInstance.FindPetsByTags(tags); + List result = apiInstance.FindPetsByTags(tags); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -254,7 +284,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -265,6 +295,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -277,7 +313,7 @@ Returns a single pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -287,14 +323,15 @@ namespace Example { public class GetPetByIdExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to return try @@ -303,9 +340,11 @@ namespace Example Pet result = apiInstance.GetPetById(petId); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -331,6 +370,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -341,7 +387,7 @@ Update an existing pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -351,12 +397,13 @@ namespace Example { public class UpdatePetExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var body = new Pet(); // Pet | Pet object that needs to be added to the store try @@ -364,9 +411,11 @@ namespace Example // Update an existing pet apiInstance.UpdatePet(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -392,6 +441,14 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -402,7 +459,7 @@ Updates a pet in the store with form data ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -412,12 +469,13 @@ namespace Example { public class UpdatePetWithFormExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet that needs to be updated var name = name_example; // string | Updated name of the pet (optional) var status = status_example; // string | Updated status of the pet (optional) @@ -427,9 +485,11 @@ namespace Example // Updates a pet in the store with form data apiInstance.UpdatePetWithForm(petId, name, status); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -457,6 +517,11 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -467,7 +532,7 @@ uploads an image ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -477,12 +542,13 @@ namespace Example { public class UploadFileExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to update var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) var file = BINARY_DATA_HERE; // System.IO.Stream | file to upload (optional) @@ -493,9 +559,11 @@ namespace Example ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -523,6 +591,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -533,7 +606,7 @@ uploads an image (required) ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -543,12 +616,13 @@ namespace Example { public class UploadFileWithRequiredFileExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure OAuth2 access token for authorization: petstore_auth Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; - var apiInstance = new PetApi(); + var apiInstance = new PetApi(Configuration.Default); var petId = 789; // long | ID of pet to update var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) @@ -559,9 +633,11 @@ namespace Example ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -589,5 +665,10 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/StoreApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/StoreApi.md index 947a0304ce8..c5143852603 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/StoreApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/StoreApi.md @@ -20,7 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -30,9 +30,10 @@ namespace Example { public class DeleteOrderExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var orderId = orderId_example; // string | ID of the order that needs to be deleted try @@ -40,9 +41,11 @@ namespace Example // Delete purchase order by ID apiInstance.DeleteOrder(orderId); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -68,11 +71,17 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **GetInventory** -> Dictionary GetInventory () +> Dictionary<string, int> GetInventory () Returns pet inventories by status @@ -80,7 +89,7 @@ Returns a map of status codes to quantities ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -90,24 +99,27 @@ namespace Example { public class GetInventoryExample { - public void main() + public static void Main() { + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; // Configure API key authorization: api_key Configuration.Default.AddApiKey("api_key", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.AddApiKeyPrefix("api_key", "Bearer"); - var apiInstance = new StoreApi(); + var apiInstance = new StoreApi(Configuration.Default); try { // Returns pet inventories by status - Dictionary<string, int> result = apiInstance.GetInventory(); + Dictionary result = apiInstance.GetInventory(); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -130,6 +142,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -142,7 +159,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -152,9 +169,10 @@ namespace Example { public class GetOrderByIdExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var orderId = 789; // long | ID of pet that needs to be fetched try @@ -163,9 +181,11 @@ namespace Example Order result = apiInstance.GetOrderById(orderId); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -191,6 +211,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -201,7 +228,7 @@ Place an order for a pet ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -211,9 +238,10 @@ namespace Example { public class PlaceOrderExample { - public void main() + public static void Main() { - var apiInstance = new StoreApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new StoreApi(Configuration.Default); var body = new Order(); // Order | order placed for purchasing the pet try @@ -222,9 +250,11 @@ namespace Example Order result = apiInstance.PlaceOrder(body); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -250,5 +280,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/UserApi.md b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/UserApi.md index 9a535e16a82..4588b440131 100644 --- a/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/UserApi.md +++ b/samples/client/petstore/csharp-netcore/OpenAPIClientCore/docs/UserApi.md @@ -24,7 +24,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -34,9 +34,10 @@ namespace Example { public class CreateUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new User(); // User | Created user object try @@ -44,9 +45,11 @@ namespace Example // Create user apiInstance.CreateUser(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -72,6 +75,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -82,7 +90,7 @@ Creates list of users with given input array ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -92,9 +100,10 @@ namespace Example { public class CreateUsersWithArrayInputExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new List(); // List | List of user object try @@ -102,9 +111,11 @@ namespace Example // Creates list of users with given input array apiInstance.CreateUsersWithArrayInput(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -115,7 +126,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -130,6 +141,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -140,7 +156,7 @@ Creates list of users with given input array ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -150,9 +166,10 @@ namespace Example { public class CreateUsersWithListInputExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var body = new List(); // List | List of user object try @@ -160,9 +177,11 @@ namespace Example // Creates list of users with given input array apiInstance.CreateUsersWithListInput(body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -173,7 +192,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -188,6 +207,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -200,7 +224,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -210,9 +234,10 @@ namespace Example { public class DeleteUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The name that needs to be deleted try @@ -220,9 +245,11 @@ namespace Example // Delete user apiInstance.DeleteUser(username); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -248,6 +275,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -258,7 +291,7 @@ Get user by user name ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -268,9 +301,10 @@ namespace Example { public class GetUserByNameExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. try @@ -279,9 +313,11 @@ namespace Example User result = apiInstance.GetUserByName(username); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -307,6 +343,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -317,7 +360,7 @@ Logs user into the system ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -327,9 +370,10 @@ namespace Example { public class LoginUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | The user name for login var password = password_example; // string | The password for login in clear text @@ -339,9 +383,11 @@ namespace Example string result = apiInstance.LoginUser(username, password); Debug.WriteLine(result); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -368,6 +414,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -378,7 +430,7 @@ Logs out current logged in user session ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -388,18 +440,21 @@ namespace Example { public class LogoutUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); try { // Logs out current logged in user session apiInstance.LogoutUser(); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -422,6 +477,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -434,7 +494,7 @@ This can only be done by the logged in user. ### Example ```csharp -using System; +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -444,9 +504,10 @@ namespace Example { public class UpdateUserExample { - public void main() + public static void Main() { - var apiInstance = new UserApi(); + Configuration.Default.BasePath = "http://petstore.swagger.io:80/v2"; + var apiInstance = new UserApi(Configuration.Default); var username = username_example; // string | name that need to be deleted var body = new User(); // User | Updated user object @@ -455,9 +516,11 @@ namespace Example // Updated user apiInstance.UpdateUser(username, body); } - catch (Exception e) + catch (ApiException e) { Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + Debug.Print("Status Code: "+ e.ErrorCode); + Debug.Print(e.StackTrace); } } } @@ -484,5 +547,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/csharp/OpenAPIClient/README.md b/samples/client/petstore/csharp/OpenAPIClient/README.md index 7a849134a1d..dcdb39631c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/README.md +++ b/samples/client/petstore/csharp/OpenAPIClient/README.md @@ -64,6 +64,7 @@ Then, publish to a [local feed](https://docs.microsoft.com/en-us/nuget/hosting-p ## Getting Started ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; diff --git a/samples/client/petstore/csharp/OpenAPIClient/build.bat b/samples/client/petstore/csharp/OpenAPIClient/build.bat index 88942a71d0f..75153d5f899 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/build.bat +++ b/samples/client/petstore/csharp/OpenAPIClient/build.bat @@ -10,8 +10,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll +copy packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\Org.OpenAPITools.dll /recurse:src\Org.OpenAPITools\*.cs /doc:bin\Org.OpenAPITools.xml diff --git a/samples/client/petstore/csharp/OpenAPIClient/build.sh b/samples/client/petstore/csharp/OpenAPIClient/build.sh index 269c087258e..7edc32f6886 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/build.sh +++ b/samples/client/petstore/csharp/OpenAPIClient/build.sh @@ -44,9 +44,9 @@ ${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; -cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.12.0.1/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.2.0/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll +cp packages/JsonSubTypes.1.5.2/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll echo "[INFO] Run 'mcs' to build bin/Org.OpenAPITools.dll" mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/AnotherFakeApi.md index 14ac2c12f24..5af41a1862c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/AnotherFakeApi.md @@ -19,6 +19,7 @@ To test special tags and operation ID starting with number ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -71,6 +72,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md index 2f97f3017da..8a53b02b5e1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeApi.md @@ -31,6 +31,7 @@ this route creates an XmlItem ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -82,6 +83,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -99,6 +105,7 @@ Test serialization of outer boolean types ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -150,6 +157,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -167,6 +179,7 @@ Test serialization of object with outer number type ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -218,6 +231,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -235,6 +253,7 @@ Test serialization of outer number types ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -286,6 +305,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -303,6 +327,7 @@ Test serialization of outer string types ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -354,6 +379,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -371,6 +401,7 @@ For this test, the body for this request much reference a schema named `File`. ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -421,6 +452,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -436,6 +472,7 @@ No authorization required ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -488,6 +525,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -505,6 +547,7 @@ To test \"client\" model ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -557,6 +600,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -574,6 +622,7 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -655,6 +704,12 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -672,6 +727,7 @@ To test enum parameters ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -737,6 +793,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -754,6 +816,7 @@ Fake endpoint to test group parameters (optional) ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -815,6 +878,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -830,6 +898,7 @@ test inline additionalProperties ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -881,6 +950,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -896,6 +970,7 @@ test json serialization of form data ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -949,6 +1024,11 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeClassnameTags123Api.md b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeClassnameTags123Api.md index acc5f0799f2..deb97a27697 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/FakeClassnameTags123Api.md @@ -19,6 +19,7 @@ To test class name in snake case ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -76,6 +77,11 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md index 3b09a069422..c45dd7854a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/PetApi.md @@ -25,6 +25,7 @@ Add a new pet to the store ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -79,6 +80,12 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -94,6 +101,7 @@ Deletes a pet ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -150,6 +158,12 @@ void (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -158,7 +172,7 @@ void (empty response body) ## FindPetsByStatus -> List FindPetsByStatus (List status) +> List<Pet> FindPetsByStatus (List status) Finds Pets by status @@ -167,6 +181,7 @@ Multiple status values can be provided with comma separated strings ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -188,7 +203,7 @@ namespace Example try { // Finds Pets by status - List<Pet> result = apiInstance.FindPetsByStatus(status); + List result = apiInstance.FindPetsByStatus(status); Debug.WriteLine(result); } catch (ApiException e) @@ -211,7 +226,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -222,6 +237,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -230,7 +251,7 @@ Name | Type | Description | Notes ## FindPetsByTags -> List FindPetsByTags (List tags) +> List<Pet> FindPetsByTags (List tags) Finds Pets by tags @@ -239,6 +260,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -260,7 +282,7 @@ namespace Example try { // Finds Pets by tags - List<Pet> result = apiInstance.FindPetsByTags(tags); + List result = apiInstance.FindPetsByTags(tags); Debug.WriteLine(result); } catch (ApiException e) @@ -283,7 +305,7 @@ Name | Type | Description | Notes ### Return type -[**List**](Pet.md) +[**List<Pet>**](Pet.md) ### Authorization @@ -294,6 +316,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -311,6 +339,7 @@ Returns a single pet ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -368,6 +397,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -383,6 +419,7 @@ Update an existing pet ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -437,6 +474,14 @@ void (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -452,6 +497,7 @@ Updates a pet in the store with form data ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -510,6 +556,11 @@ void (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -525,6 +576,7 @@ uploads an image ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -584,6 +636,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -599,6 +656,7 @@ uploads an image (required) ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -658,6 +716,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/StoreApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/StoreApi.md index 379c4ef3943..b4dc72258a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/StoreApi.md @@ -22,6 +22,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -73,6 +74,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -81,7 +88,7 @@ No authorization required ## GetInventory -> Dictionary GetInventory () +> Dictionary<string, int?> GetInventory () Returns pet inventories by status @@ -90,6 +97,7 @@ Returns a map of status codes to quantities ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -112,7 +120,7 @@ namespace Example try { // Returns pet inventories by status - Dictionary<string, int?> result = apiInstance.GetInventory(); + Dictionary result = apiInstance.GetInventory(); Debug.WriteLine(result); } catch (ApiException e) @@ -143,6 +151,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -160,6 +173,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -212,6 +226,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -227,6 +248,7 @@ Place an order for a pet ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -279,6 +301,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md index 8d41e64c6b0..1385d840413 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/UserApi.md @@ -26,6 +26,7 @@ This can only be done by the logged in user. ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -77,6 +78,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -92,6 +98,7 @@ Creates list of users with given input array ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -128,7 +135,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -143,6 +150,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -158,6 +170,7 @@ Creates list of users with given input array ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -194,7 +207,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -209,6 +222,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -226,6 +244,7 @@ This can only be done by the logged in user. ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -277,6 +296,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -292,6 +317,7 @@ Get user by user name ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -344,6 +370,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -359,6 +392,7 @@ Logs user into the system ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -413,6 +447,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -428,6 +468,7 @@ Logs out current logged in user session ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -475,6 +516,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) @@ -492,6 +538,7 @@ This can only be done by the logged in user. ### Example ```csharp +using System.Collections.Generic; using System.Diagnostics; using Org.OpenAPITools.Api; using Org.OpenAPITools.Client; @@ -545,6 +592,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) diff --git a/samples/client/petstore/csharp/OpenAPIClient/mono_nunit_test.sh b/samples/client/petstore/csharp/OpenAPIClient/mono_nunit_test.sh index 039eba8ed42..ef4209de27b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/OpenAPIClient/mono_nunit_test.sh @@ -14,9 +14,9 @@ wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe mozroots --import --sync mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +echo "[INFO] Install NUnit Console 3.x runners via NuGet" +mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild Org.OpenAPITools.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs index 3564cba1bbc..f52b503cea2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/AnotherFakeApiTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class AnotherFakeApiTests { private AnotherFakeApi instance; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs index c7274563e0e..8245961e05f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeApiTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class FakeApiTests { private FakeApi instance; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs index 941cf048285..01c0d864db4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/FakeClassnameTags123ApiTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class FakeClassnameTags123ApiTests { private FakeClassnameTags123Api instance; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs index 6bc3db2a81f..5a2aa03f4b7 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/PetApiTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -20,7 +20,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by Swagger Codegen. /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class PetApiTests { private PetApi instance; @@ -97,7 +96,7 @@ namespace Org.OpenAPITools.Test [Test] public void InstanceTest() { - Assert.IsInstanceOf(instance); + Assert.IsInstanceOf(typeof(PetApi), instance); } @@ -133,7 +132,7 @@ namespace Org.OpenAPITools.Test List listPet = petApi.FindPetsByTags(tagsList); foreach (Pet pet in listPet) // Loop through List with foreach. { - Assert.IsInstanceOf(pet); + Assert.IsInstanceOf(typeof(Pet), pet); Assert.AreEqual("csharp sample tag name1", pet.Tags[0]); } } @@ -146,7 +145,7 @@ namespace Org.OpenAPITools.Test { List tags = new List(new String[] { "pet" }); var response = instance.FindPetsByTags(tags); - Assert.IsInstanceOf>(response); + Assert.IsInstanceOf(typeof(List), response); } /// @@ -162,19 +161,19 @@ namespace Org.OpenAPITools.Test PetApi petApi = new PetApi(c1); Pet response = petApi.GetPetById(petId); - Assert.IsInstanceOf(response); + Assert.IsInstanceOf(typeof(Pet), response); Assert.AreEqual("Csharp test", response.Name); Assert.AreEqual(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); + Assert.IsInstanceOf(typeof(List), response.Tags); Assert.AreEqual(petId, response.Tags[0].Id); Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); + Assert.IsInstanceOf(typeof(List), response.PhotoUrls); Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); + Assert.IsInstanceOf(typeof(Category), response.Category); Assert.AreEqual(56, response.Category.Id); Assert.AreEqual("sample category name2", response.Category.Name); } @@ -188,19 +187,19 @@ namespace Org.OpenAPITools.Test PetApi petApi = new PetApi(); var task = petApi.GetPetByIdAsync(petId); Pet response = task.Result; - Assert.IsInstanceOf(response); + Assert.IsInstanceOf(typeof(Pet), response); Assert.AreEqual("Csharp test", response.Name); Assert.AreEqual(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); + Assert.IsInstanceOf(typeof(List), response.Tags); Assert.AreEqual(petId, response.Tags[0].Id); Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); + Assert.IsInstanceOf(typeof(List), response.PhotoUrls); Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); + Assert.IsInstanceOf(typeof(Category), response.Category); Assert.AreEqual(56, response.Category.Id); Assert.AreEqual("sample category name2", response.Category.Name); } @@ -219,19 +218,19 @@ namespace Org.OpenAPITools.Test Assert.AreEqual(task.Result.Headers["Content-Type"], "application/json"); Pet response = task.Result.Data; - Assert.IsInstanceOf(response); + Assert.IsInstanceOf(typeof(Pet), response); Assert.AreEqual("Csharp test", response.Name); Assert.AreEqual(Pet.StatusEnum.Available, response.Status); - Assert.IsInstanceOf>(response.Tags); + Assert.IsInstanceOf(typeof(List), response.Tags); Assert.AreEqual(petId, response.Tags[0].Id); Assert.AreEqual("csharp sample tag name1", response.Tags[0].Name); - Assert.IsInstanceOf>(response.PhotoUrls); + Assert.IsInstanceOf(typeof(List), response.PhotoUrls); Assert.AreEqual("sample photoUrls", response.PhotoUrls[0]); - Assert.IsInstanceOf(response.Category); + Assert.IsInstanceOf(typeof(Category), response.Category); Assert.AreEqual(56, response.Category.Id); Assert.AreEqual("sample category name2", response.Category.Name); } @@ -257,9 +256,9 @@ namespace Org.OpenAPITools.Test petApi.UpdatePetWithForm(petId, "new form name", "pending"); Pet response = petApi.GetPetById(petId); - Assert.IsInstanceOf(response); - Assert.IsInstanceOf(response.Category); - Assert.IsInstanceOf>(response.Tags); + Assert.IsInstanceOf(typeof(Pet), response); + Assert.IsInstanceOf(typeof(Category), response.Category); + Assert.IsInstanceOf(typeof(List), response.Tags); Assert.AreEqual("new form name", response.Name); Assert.AreEqual(Pet.StatusEnum.Pending, response.Status); diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs index 89768ca854e..41d065c8be9 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/StoreApiTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class StoreApiTests { private StoreApi instance; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs index ce7ccbc5e95..befdfe04de3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Api/UserApiTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the API endpoint. /// - [TestFixture] public class UserApiTests { private UserApi instance; diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Client/ApiClientTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Client/ApiClientTests.cs index 633330e3bcf..d9637bd92e4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Client/ApiClientTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Client/ApiClientTests.cs @@ -69,7 +69,7 @@ namespace Org.OpenAPITools.Test } // The test below only passes when running at -04:00 timezone - [Ignore()] + [Ignore("The test below only passes when running at -04:00 timezone")] public void TestParameterToStringWithTimeZoneForDateTime() { ApiClient api = new ApiClient(); @@ -136,4 +136,4 @@ namespace Org.OpenAPITools.Test } } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesAnyTypeTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesAnyTypeTests.cs index 38461dbaf93..799a923c571 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesAnyTypeTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesAnyTypeTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesAnyTypeTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesAnyType diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesArrayTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesArrayTests.cs index 88957b1672d..7543ec159c3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesArrayTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesArrayTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesArrayTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesArray diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesBooleanTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesBooleanTests.cs index 3170d95ee4b..3180b1237a8 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesBooleanTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesBooleanTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesBooleanTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesBoolean diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs index 9d6a6426c9b..9ed6376a5b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesClassTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesClassTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesClass diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesIntegerTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesIntegerTests.cs index 6ee92130162..7bdcee4b637 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesIntegerTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesIntegerTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesIntegerTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesInteger diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesNumberTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesNumberTests.cs index 25c4e87498c..61d2c0389f4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesNumberTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesNumberTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesNumberTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesNumber diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesObjectTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesObjectTests.cs index ce6e19f5fcf..502718f42cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesObjectTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesObjectTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesObjectTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesObject diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesStringTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesStringTests.cs index 6c6cbad5e49..2e5414c3730 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesStringTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AdditionalPropertiesStringTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AdditionalPropertiesStringTests { // TODO uncomment below to declare an instance variable for AdditionalPropertiesString diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs index 2849d780c8d..108e4e1557d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/AnimalTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class AnimalTests { // TODO uncomment below to declare an instance variable for Animal diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs index 70c07575145..2640f864df6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ApiResponseTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ApiResponseTests { // TODO uncomment below to declare an instance variable for ApiResponse diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs index 5eb86a38573..ba3ff03b3c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfArrayOfNumberOnlyTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ArrayOfArrayOfNumberOnlyTests { // TODO uncomment below to declare an instance variable for ArrayOfArrayOfNumberOnly diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs index cd7074afaa1..55f896463a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayOfNumberOnlyTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ArrayOfNumberOnlyTests { // TODO uncomment below to declare an instance variable for ArrayOfNumberOnly diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs index f1f286ce448..80fd020890f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ArrayTestTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ArrayTestTests { // TODO uncomment below to declare an instance variable for ArrayTest diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs index cb003b2abee..6e2b957083a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CapitalizationTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class CapitalizationTests { // TODO uncomment below to declare an instance variable for Capitalization diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs index 6cd18d546ed..02b9f47b82b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CatTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class CatTests { // TODO uncomment below to declare an instance variable for Cat diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs index f964723517e..6b5ddc1906b 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/CategoryTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class CategoryTests { // TODO uncomment below to declare an instance variable for Category diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs index 0a6de083da5..f64883e9ff3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ClassModelTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ClassModelTests { // TODO uncomment below to declare an instance variable for ClassModel diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs index fbae571470b..083be397f77 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/DogTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class DogTests { // TODO uncomment below to declare an instance variable for Dog diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs index 1760e0d4ef3..8ae6a179e77 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumArraysTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class EnumArraysTests { // TODO uncomment below to declare an instance variable for EnumArrays diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs index f1c67fe1914..10ae874e846 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumClassTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class EnumClassTests { // TODO uncomment below to declare an instance variable for EnumClass diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs index 6ba0c31db41..bd96d5636d1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class EnumTestTests { // TODO uncomment below to declare an instance variable for EnumTest diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs index bb47c43dc7a..e1ad9a0c243 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class FileSchemaTestClassTests { // TODO uncomment below to declare an instance variable for FileSchemaTestClass diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs index f1cf54c22e4..acaf56152c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class FileTests { // TODO uncomment below to declare an instance variable for File diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs index cca85ec5b2a..2c7ce557ca1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/FormatTestTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class FormatTestTests { // TODO uncomment below to declare an instance variable for FormatTest diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs index 1fef4b1371e..4669408d886 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/HasOnlyReadOnlyTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class HasOnlyReadOnlyTests { // TODO uncomment below to declare an instance variable for HasOnlyReadOnly diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs index 983fd757c32..8fd5456835c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ListTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ListTests { // TODO uncomment below to declare an instance variable for List diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs index 9bb76bde239..508dc3c1381 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MapTestTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class MapTestTests { // TODO uncomment below to declare an instance variable for MapTest diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs index 72e5a9130b9..9d963599991 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/MixedPropertiesAndAdditionalPropertiesClassTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class MixedPropertiesAndAdditionalPropertiesClassTests { // TODO uncomment below to declare an instance variable for MixedPropertiesAndAdditionalPropertiesClass diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs index f85a9a6a581..701423909c0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/Model200ResponseTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class Model200ResponseTests { // TODO uncomment below to declare an instance variable for Model200Response diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs index db4530153a8..4da1fdf73e5 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ModelClientTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ModelClientTests { // TODO uncomment below to declare an instance variable for ModelClient diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs index 5575f11af51..d7f80082aee 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NameTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class NameTests { // TODO uncomment below to declare an instance variable for Name diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs index d9b5c4ea499..48428b86b35 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/NumberOnlyTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class NumberOnlyTests { // TODO uncomment below to declare an instance variable for NumberOnly diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs index 36853bd0d17..add9d154fb3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OrderTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class OrderTests { // TODO uncomment below to declare an instance variable for Order diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs index 7069f4e9554..bcfdd4516cb 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterCompositeTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class OuterCompositeTests { // TODO uncomment below to declare an instance variable for OuterComposite diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs index f482ff479ec..bd71a2ed183 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/OuterEnumTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class OuterEnumTests { // TODO uncomment below to declare an instance variable for OuterEnum diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs index 3261b8b18e7..7507d9f74e3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/PetTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class PetTests { private Pet instance; @@ -61,7 +60,7 @@ namespace Org.OpenAPITools.Test [Test] public void PetInstanceTest() { - Assert.IsInstanceOfType(typeof(Pet), instance); + Assert.IsInstanceOf(typeof(Pet), instance); } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs index cf1a8f54bb8..c2823e5ca49 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReadOnlyFirstTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ReadOnlyFirstTests { // TODO uncomment below to declare an instance variable for ReadOnlyFirst diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs index 1ac79a9f910..176d55e5fe4 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/ReturnTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class ReturnTests { // TODO uncomment below to declare an instance variable for Return diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs index 0a4dcb6a7bc..0902a6d961c 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/SpecialModelNameTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class SpecialModelNameTests { // TODO uncomment below to declare an instance variable for SpecialModelName diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs index 52ee4ca988f..b4927515fe1 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TagTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class TagTests { // TODO uncomment below to declare an instance variable for Tag diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs index f4c78879bf0..476af27f1f3 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderDefaultTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class TypeHolderDefaultTests { // TODO uncomment below to declare an instance variable for TypeHolderDefault diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs index a4760f2c4c9..cf220d7d6ff 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/TypeHolderExampleTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class TypeHolderExampleTests { // TODO uncomment below to declare an instance variable for TypeHolderExample diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs index 8e073d2aa0e..506ddc1ddc6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/UserTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class UserTests { // TODO uncomment below to declare an instance variable for User diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs index b936ec597e0..d1646dc97d0 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Model/XmlItemTests.cs @@ -30,7 +30,6 @@ namespace Org.OpenAPITools.Test /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). /// Please update the test case below to test the model. /// - [TestFixture] public class XmlItemTests { // TODO uncomment below to declare an instance variable for XmlItem diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index e510bba3f59..c7a19d07a9f 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -47,16 +47,16 @@ OpenAPI spec version: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -65,10 +65,10 @@ OpenAPI spec version: 1.0.0 ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config index ac390c1dcb3..e70b078702d 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools.Test/packages.config @@ -1,7 +1,7 @@ - + - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj index bd27e1ca756..9356e9991f6 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -50,16 +50,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec index c49c57e4403..c275a14d2af 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -25,8 +25,8 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/packages.config b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/packages.config index 3caf34e0d76..a970e5e3a96 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/packages.config @@ -1,6 +1,6 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/build.bat b/samples/client/petstore/csharp/OpenAPIClientNet35/build.bat index 563159f27b9..3910f59e988 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/build.bat +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/build.bat @@ -10,8 +10,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll bin\JsonSubTypes.dll +copy packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll bin\JsonSubTypes.dll copy packages\RestSharp.105.1.0\lib\net35\RestSharp.dll bin\RestSharp.dll %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\Org.OpenAPITools.dll /recurse:src\Org.OpenAPITools\*.cs /doc:bin\Org.OpenAPITools.xml diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/build.sh b/samples/client/petstore/csharp/OpenAPIClientNet35/build.sh index 57640ebc2d7..d0a31cd3c55 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/build.sh +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/build.sh @@ -44,9 +44,9 @@ ${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; -cp packages/Newtonsoft.Json.10.0.3/lib/net35/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.12.0.1/lib/net35/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net35/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.2.0/lib/net35/JsonSubTypes.dll bin/JsonSubTypes.dll +cp packages/JsonSubTypes.1.5.2/lib/net35/JsonSubTypes.dll bin/JsonSubTypes.dll echo "[INFO] Run 'mcs' to build bin/Org.OpenAPITools.dll" mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/mono_nunit_test.sh b/samples/client/petstore/csharp/OpenAPIClientNet35/mono_nunit_test.sh index 039eba8ed42..ef4209de27b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/mono_nunit_test.sh @@ -14,9 +14,9 @@ wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe mozroots --import --sync mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +echo "[INFO] Install NUnit Console 3.x runners via NuGet" +mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild Org.OpenAPITools.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 9e22db187c4..155563e5570 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -47,16 +47,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net35\RestSharp.dll @@ -65,10 +65,10 @@ The version of the OpenAPI document: 1.0.0 ..\..\vendor\RestSharp.105.1.0\lib\net35\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/packages.config b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/packages.config index 403ae200190..9e1acaaaa37 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/packages.config @@ -1,7 +1,7 @@ - + - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.csproj index dcba0060768..89be9eb56e2 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -50,16 +50,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net35\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net35\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net35\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net35\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net35\RestSharp.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.nuspec index c49c57e4403..c275a14d2af 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.nuspec +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -25,8 +25,8 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/packages.config b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/packages.config index 149e1472a7a..bd2e3e6607f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/packages.config @@ -1,6 +1,6 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/build.bat b/samples/client/petstore/csharp/OpenAPIClientNet40/build.bat index 26264134050..0bf67cfa4a7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/build.bat +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/build.bat @@ -10,8 +10,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll bin\JsonSubTypes.dll +copy packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll bin\JsonSubTypes.dll copy packages\RestSharp.105.1.0\lib\net4\RestSharp.dll bin\RestSharp.dll %CSCPATH%\csc /reference:bin\Newtonsoft.Json.dll;bin\JsonSubTypes.dll;bin\RestSharp.dll;System.ComponentModel.DataAnnotations.dll /target:library /out:bin\Org.OpenAPITools.dll /recurse:src\Org.OpenAPITools\*.cs /doc:bin\Org.OpenAPITools.xml diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/build.sh b/samples/client/petstore/csharp/OpenAPIClientNet40/build.sh index 31f579a7f29..791a3a16b60 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/build.sh +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/build.sh @@ -44,9 +44,9 @@ ${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; -cp packages/Newtonsoft.Json.10.0.3/lib/net40/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.12.0.1/lib/net40/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net4/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.2.0/lib/net40/JsonSubTypes.dll bin/JsonSubTypes.dll +cp packages/JsonSubTypes.1.5.2/lib/net40/JsonSubTypes.dll bin/JsonSubTypes.dll echo "[INFO] Run 'mcs' to build bin/Org.OpenAPITools.dll" mcs -langversion:${langversion} -sdk:${sdk} -r:bin/Newtonsoft.Json.dll,bin/JsonSubTypes.dll,\ diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/mono_nunit_test.sh b/samples/client/petstore/csharp/OpenAPIClientNet40/mono_nunit_test.sh index 039eba8ed42..ef4209de27b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/mono_nunit_test.sh @@ -14,9 +14,9 @@ wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe mozroots --import --sync mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +echo "[INFO] Install NUnit Console 3.x runners via NuGet" +mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild Org.OpenAPITools.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index f977b43d8a5..e40d730a807 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -47,16 +47,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll @@ -65,10 +65,10 @@ The version of the OpenAPI document: 1.0.0 ..\..\vendor\RestSharp.105.1.0\lib\net4\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/packages.config b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/packages.config index 0768a494dc4..86d33422d46 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/packages.config @@ -1,7 +1,7 @@ - + - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 0087e256c5b..f034307d971 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -50,16 +50,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net40\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net40\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net40\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net40\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net4\RestSharp.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.nuspec index c49c57e4403..c275a14d2af 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.nuspec +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -25,8 +25,8 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/packages.config b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/packages.config index 9c99469f255..5561d895e9e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/packages.config @@ -1,6 +1,6 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/project.json b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/project.json index d5d3017c216..b06adc0ade6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/project.json +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/project.json @@ -3,10 +3,10 @@ "dependencies": { "FubarCoder.RestSharp.Portable.Core": "4.0.7", "FubarCoder.RestSharp.Portable.HttpClient": "4.0.7", - "Newtonsoft.Json": "10.0.3", - "JsonSubTypes": "1.2.0" + "Newtonsoft.Json": "12.0.1", + "JsonSubTypes": "1.5.2" }, "frameworks": { "netstandard1.3": {} } -} \ No newline at end of file +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.bat b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.bat index 4a96110196e..6cfcc5b213e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.bat +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.bat @@ -10,8 +10,8 @@ if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient if not exist ".\bin" mkdir bin -copy packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll -copy packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll +copy packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll bin\Newtonsoft.Json.dll +copy packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll bin\JsonSubTypes.dll copy packages\RestSharp.105.1.0\lib\net45\RestSharp.dll bin\RestSharp.dll copy packages\Fody.1.29.4\Fody.dll bin\Fody.dll copy packages\PropertyChanged.Fody.1.51.3\PropertyChanged.Fody.dll bin\PropertyChanged.Fody.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.sh b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.sh index 9297d1388d5..7a5668e35c5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.sh +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/build.sh @@ -44,9 +44,9 @@ ${nuget_cmd} install src/Org.OpenAPITools/packages.config -o packages; echo "[INFO] Copy DLLs to the 'bin' folder" mkdir -p bin; -cp packages/Newtonsoft.Json.10.0.3/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; +cp packages/Newtonsoft.Json.12.0.1/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll; cp packages/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll; -cp packages/JsonSubTypes.1.2.0/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll +cp packages/JsonSubTypes.1.5.2/lib/net45/JsonSubTypes.dll bin/JsonSubTypes.dll cp packages/Fody.1.29.4/Fody.dll bin/Fody.dll cp packages/PropertyChanged.Fody.1.51.3/PropertyChanged.Fody.dll bin/PropertyChanged.Fody.dll cp packages/PropertyChanged.Fody.1.51.3/Lib/dotnet/PropertyChanged.dll bin/PropertyChanged.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/mono_nunit_test.sh b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/mono_nunit_test.sh index 039eba8ed42..ef4209de27b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/mono_nunit_test.sh +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/mono_nunit_test.sh @@ -14,9 +14,9 @@ wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe mozroots --import --sync mono nuget.exe install src/Org.OpenAPITools.Test/packages.config -o packages -echo "[INFO] Install NUnit runners via NuGet" -mono nuget.exe install NUnit.Runners -Version 2.6.4 -OutputDirectory packages +echo "[INFO] Install NUnit Console 3.x runners via NuGet" +mono nuget.exe install NUnit.ConsoleRunner -Version 3.10.0 -OutputDirectory packages echo "[INFO] Build the solution and run the unit test" xbuild Org.OpenAPITools.sln && \ - mono ./packages/NUnit.Runners.2.6.4/tools/nunit-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll + mono ./packages/NUnit.ConsoleRunner.3.10.0/tools/nunit3-console.exe src/Org.OpenAPITools.Test/bin/Debug/Org.OpenAPITools.Test.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj index 13b29c8ed5e..e923e5727b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj @@ -47,16 +47,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll @@ -65,10 +65,10 @@ The version of the OpenAPI document: 1.0.0 ..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll - $(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - ..\..\vendor\NUnit.2.6.4\lib\nunit.framework.dll + $(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll + ..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/packages.config b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/packages.config index ac390c1dcb3..e70b078702d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/packages.config @@ -1,7 +1,7 @@ - + - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 21d6a6d9c17..4a270f3b904 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -50,16 +50,16 @@ The version of the OpenAPI document: 1.0.0 - $(SolutionDir)\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll - ..\..\vendor\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + $(SolutionDir)\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\..\vendor\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - $(SolutionDir)\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\packages\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll - ..\..\vendor\JsonSubTypes.1.2.0\lib\net45\JsonSubTypes.dll + $(SolutionDir)\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\packages\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll + ..\..\vendor\JsonSubTypes.1.5.2\lib\net45\JsonSubTypes.dll $(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.nuspec b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.nuspec index 0be2d6a6ee1..0b279146237 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.nuspec +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Org.OpenAPITools.nuspec @@ -25,8 +25,8 @@ - - + + diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/packages.config b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/packages.config index b45bbc1cf36..f7e188fb0db 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/packages.config +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/packages.config @@ -1,8 +1,8 @@ - - + + diff --git a/samples/client/petstore/go/auth_test.go b/samples/client/petstore/go/auth_test.go index ab152c98d1f..5f817703a88 100644 --- a/samples/client/petstore/go/auth_test.go +++ b/samples/client/petstore/go/auth_test.go @@ -43,8 +43,7 @@ func TestOAuth2(t *testing.T) { r, err := client.PetApi.AddPet(context.Background(), newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -53,8 +52,7 @@ func TestOAuth2(t *testing.T) { r, err = client.PetApi.DeletePet(auth, 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -79,8 +77,7 @@ func TestBasicAuth(t *testing.T) { r, err := client.PetApi.AddPet(auth, newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -89,8 +86,7 @@ func TestBasicAuth(t *testing.T) { r, err = client.PetApi.DeletePet(auth, 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -110,8 +106,7 @@ func TestAccessToken(t *testing.T) { r, err := client.PetApi.AddPet(nil, newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -120,8 +115,7 @@ func TestAccessToken(t *testing.T) { r, err = client.PetApi.DeletePet(auth, 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -141,8 +135,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { r, err := client.PetApi.AddPet(context.Background(), newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -150,8 +143,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { _, r, err = client.PetApi.GetPetById(auth, 12992) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } reqb, _ := httputil.DumpRequest(r.Request, true) @@ -161,8 +153,7 @@ func TestAPIKeyNoPrefix(t *testing.T) { r, err = client.PetApi.DeletePet(auth, 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -178,8 +169,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { r, err := client.PetApi.AddPet(nil, newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -187,8 +177,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { _, r, err = client.PetApi.GetPetById(auth, 12992) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } reqb, _ := httputil.DumpRequest(r.Request, true) @@ -198,8 +187,7 @@ func TestAPIKeyWithPrefix(t *testing.T) { r, err = client.PetApi.DeletePet(auth, 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -214,8 +202,7 @@ func TestDefaultHeader(t *testing.T) { r, err := client.PetApi.AddPet(context.Background(), newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -224,8 +211,7 @@ func TestDefaultHeader(t *testing.T) { r, err = client.PetApi.DeletePet(context.Background(), 12992, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -240,15 +226,26 @@ func TestHostOverride(t *testing.T) { _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) if err != nil { - t.Errorf("Error while finding pets by status") - t.Log(err) + t.Fatalf("Error while finding pets by status: %v", err) } - if r.Request.Host != testHost { + if r.Request.URL.Host != testHost { t.Errorf("Request Host is %v, expected %v", r.Request.Host, testHost) } } +func TestSchemeOverride(t *testing.T) { + _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) + + if err != nil { + t.Fatalf("Error while finding pets by status: %v", err) + } + + if r.Request.URL.Scheme != testScheme { + t.Errorf("Request Scheme is %v, expected %v", r.Request.URL.Scheme, testScheme) + } +} + // Add custom clients to the context. func createContext(httpClient *http.Client) context.Context { parent := oauth2.NoContext diff --git a/samples/client/petstore/go/fake_api_test.go b/samples/client/petstore/go/fake_api_test.go index 94b7fee3ed5..f4242b5048c 100644 --- a/samples/client/petstore/go/fake_api_test.go +++ b/samples/client/petstore/go/fake_api_test.go @@ -20,8 +20,7 @@ func TestPutBodyWithFileSchema(t *testing.T) { r, err := client.FakeApi.TestBodyWithFileSchema(context.Background(), schema) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) diff --git a/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION index afa63656064..83a328a9227 100644 --- a/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION +++ b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore-withXml/README.md b/samples/client/petstore/go/go-petstore-withXml/README.md index b063933c1d5..a0aa0040ef3 100644 --- a/samples/client/petstore/go/go-petstore-withXml/README.md +++ b/samples/client/petstore/go/go-petstore-withXml/README.md @@ -12,7 +12,8 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat ## Installation Install the following dependencies: -``` + +```shell go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context @@ -20,6 +21,7 @@ go get github.com/antihax/optional ``` Put the package under your project folder and add the following in import: + ```golang import "./petstore" ``` @@ -70,7 +72,14 @@ Class | Method | HTTP request | Description ## Documentation For Models + - [AdditionalPropertiesAnyType](docs/AdditionalPropertiesAnyType.md) + - [AdditionalPropertiesArray](docs/AdditionalPropertiesArray.md) + - [AdditionalPropertiesBoolean](docs/AdditionalPropertiesBoolean.md) - [AdditionalPropertiesClass](docs/AdditionalPropertiesClass.md) + - [AdditionalPropertiesInteger](docs/AdditionalPropertiesInteger.md) + - [AdditionalPropertiesNumber](docs/AdditionalPropertiesNumber.md) + - [AdditionalPropertiesObject](docs/AdditionalPropertiesObject.md) + - [AdditionalPropertiesString](docs/AdditionalPropertiesString.md) - [Animal](docs/Animal.md) - [ApiResponse](docs/ApiResponse.md) - [ArrayOfArrayOfNumberOnly](docs/ArrayOfArrayOfNumberOnly.md) @@ -78,10 +87,12 @@ Class | Method | HTTP request | Description - [ArrayTest](docs/ArrayTest.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) - [Category](docs/Category.md) - [ClassModel](docs/ClassModel.md) - [Client](docs/Client.md) - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) @@ -111,40 +122,56 @@ Class | Method | HTTP request | Description ## Documentation For Authorization + + ## api_key -- **Type**: API key + +- **Type**: API key Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. }) r, err := client.Service.Operation(auth, args) ``` + + ## api_key_query -- **Type**: API key + +- **Type**: API key Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. }) r, err := client.Service.Operation(auth, args) ``` + + ## http_basic_test + - **Type**: HTTP basic authentication Example + ```golang auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", + UserName: "username", + Password: "password", }) r, err := client.Service.Operation(auth, args) ``` + + ## petstore_auth + + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog @@ -153,12 +180,14 @@ r, err := client.Service.Operation(auth, args) - **read:pets**: read your pets Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` Or via OAuth2 module to automatically refresh tokens and perform user authentication. + ```golang import "golang.org/x/oauth2" @@ -169,6 +198,7 @@ auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` + ## Author diff --git a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml index 7212ef07c27..5a020a1d0ab 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml @@ -32,6 +32,9 @@ paths: description: Pet object that needs to be added to the store required: true responses: + 200: + content: {} + description: successful operation 405: content: {} description: Invalid input @@ -56,6 +59,9 @@ paths: description: Pet object that needs to be added to the store required: true responses: + 200: + content: {} + description: successful operation 400: content: {} description: Invalid ID supplied @@ -120,7 +126,8 @@ paths: /pet/findByTags: get: deprecated: true - description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - description: Tags to filter by @@ -173,6 +180,9 @@ paths: format: int64 type: integer responses: + 200: + content: {} + description: successful operation 400: content: {} description: Invalid pet value @@ -332,7 +342,8 @@ paths: x-codegen-request-body-name: body /store/order/{order_id}: delete: - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted @@ -352,7 +363,8 @@ paths: tags: - store get: - description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions operationId: getOrderById parameters: - description: ID of pet that needs to be fetched @@ -1072,7 +1084,8 @@ paths: x-codegen-request-body-name: body /fake/body-with-file-schema: put: - description: For this test, the body for this request much reference a schema named `File`. + description: For this test, the body for this request much reference a schema + named `File`. operationId: testBodyWithFileSchema requestBody: content: @@ -1350,17 +1363,11 @@ components: Dog: allOf: - $ref: '#/components/schemas/Animal' - - properties: - breed: - type: string - type: object + - $ref: '#/components/schemas/Dog_allOf' Cat: allOf: - $ref: '#/components/schemas/Animal' - - properties: - declawed: - type: boolean - type: object + - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: propertyName: className @@ -2009,6 +2016,14 @@ components: xml: namespace: http://a.com/schema prefix: pre + Dog_allOf: + properties: + breed: + type: string + Cat_allOf: + properties: + declawed: + type: boolean securitySchemes: petstore_auth: flows: @@ -2028,4 +2043,4 @@ components: type: apiKey http_basic_test: scheme: basic - type: http \ No newline at end of file + type: http diff --git a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go index 7396effd641..c6d1c262556 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_another_fake.go @@ -15,7 +15,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -34,7 +33,7 @@ To test special tags and operation ID starting with number */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake.go b/samples/client/petstore/go/go-petstore-withXml/api_fake.go index dcc48da6937..b943fc4be88 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -15,7 +15,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "github.com/antihax/optional" "os" ) @@ -35,7 +34,7 @@ this route creates an XmlItem */ func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -110,7 +109,7 @@ type FakeOuterBooleanSerializeOpts struct { func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -208,7 +207,7 @@ type FakeOuterCompositeSerializeOpts struct { func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -310,7 +309,7 @@ type FakeOuterNumberSerializeOpts struct { func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -408,7 +407,7 @@ type FakeOuterStringSerializeOpts struct { func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -499,7 +498,7 @@ For this test, the body for this request much reference a schema named `Fil */ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSchemaTestClass) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -567,7 +566,7 @@ FakeApiService */ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -637,7 +636,7 @@ To test \"client\" model */ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -753,7 +752,7 @@ type TestEndpointParametersOpts struct { func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -897,7 +896,7 @@ type TestEnumParametersOpts struct { func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1000,7 +999,7 @@ type TestGroupParametersOpts struct { func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1077,7 +1076,7 @@ FakeApiService test inline additionalProperties */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param map[string]string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1145,7 +1144,7 @@ FakeApiService test json serialization of form data */ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go index 82217020bb2..dd7a0babfed 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go @@ -15,7 +15,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -34,7 +33,7 @@ To test class name in snake case */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/api_pet.go b/samples/client/petstore/go/go-petstore-withXml/api_pet.go index 7f09af3a7b1..6b159c5001a 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -15,8 +15,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" "github.com/antihax/optional" "os" ) @@ -35,7 +35,7 @@ PetApiService Add a new pet to the store */ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -109,7 +109,7 @@ type DeletePetOpts struct { func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -180,7 +180,7 @@ Multiple status values can be provided with comma separated strings */ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -268,7 +268,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 */ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -356,7 +356,7 @@ Returns a single pet */ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -454,7 +454,7 @@ PetApiService Update an existing pet */ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -530,7 +530,7 @@ type UpdatePetWithFormOpts struct { func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -612,7 +612,7 @@ type UploadFileOpts struct { func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -725,7 +725,7 @@ type UploadFileWithRequiredFileOpts struct { func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/api_store.go b/samples/client/petstore/go/go-petstore-withXml/api_store.go index 50ca891a257..ae780c2998e 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -15,8 +15,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -34,7 +34,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -101,7 +101,7 @@ Returns a map of status codes to quantities */ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -200,7 +200,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other val */ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -293,7 +293,7 @@ StoreApiService Place an order for a pet */ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/api_user.go b/samples/client/petstore/go/go-petstore-withXml/api_user.go index 29be65f0856..be573458c73 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -15,8 +15,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -34,7 +34,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -101,7 +101,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -168,7 +168,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -236,7 +236,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -303,7 +303,7 @@ UserApiService Get user by user name */ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -391,7 +391,7 @@ UserApiService Logs user into the system */ func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -477,7 +477,7 @@ UserApiService Logs out current logged in user session */ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -544,7 +544,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 87152ec107b..9c9943dd671 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -230,10 +230,11 @@ func (c *APIClient) prepareRequest( if err != nil { return nil, err } - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() @@ -255,6 +256,16 @@ func (c *APIClient) prepareRequest( return nil, err } + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + // Adding Query Param query := url.Query() for k, v := range queryParams { @@ -285,11 +296,6 @@ func (c *APIClient) prepareRequest( localVarRequest.Header = headers } - // Override request host, if applicable - if c.cfg.Host != "" { - localVarRequest.Host = c.cfg.Host - } - // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) @@ -329,6 +335,10 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -383,7 +393,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { - xml.NewEncoder(bodyBuf).Encode(body) + err = xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { diff --git a/samples/client/petstore/rust/docs/InlineObject.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesAnyType.md similarity index 65% rename from samples/client/petstore/rust/docs/InlineObject.md rename to samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesAnyType.md index ae2c737efca..eadec3142ce 100644 --- a/samples/client/petstore/rust/docs/InlineObject.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesAnyType.md @@ -1,10 +1,10 @@ -# InlineObject +# AdditionalPropertiesAnyType ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **String** | Updated name of the pet | [optional] -**status** | **String** | Updated status of the pet | [optional] +**Name** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/InlineObject1.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesArray.md similarity index 59% rename from samples/client/petstore/rust/docs/InlineObject1.md rename to samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesArray.md index 02ca4d03484..0c37598aeb2 100644 --- a/samples/client/petstore/rust/docs/InlineObject1.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesArray.md @@ -1,10 +1,10 @@ -# InlineObject1 +# AdditionalPropertiesArray ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**additional_metadata** | **String** | Additional data to pass to server | [optional] -**file** | [***&std::path::Path**](&std::path::Path.md) | file to upload | [optional] +**Name** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesBoolean.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesBoolean.md new file mode 100644 index 00000000000..7190fe8429b --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesBoolean.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesBoolean + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesClass.md index 0c8ba7085b3..877a5d45a31 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesClass.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesClass.md @@ -1,10 +1,20 @@ # AdditionalPropertiesClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**MapProperty** | **map[string]string** | | [optional] -**MapOfMapProperty** | [**map[string]map[string]string**](map.md) | | [optional] +**MapString** | **map[string]string** | | [optional] +**MapNumber** | **map[string]float32** | | [optional] +**MapInteger** | **map[string]int32** | | [optional] +**MapBoolean** | **map[string]bool** | | [optional] +**MapArrayInteger** | [**map[string][]int32**](array.md) | | [optional] +**MapArrayAnytype** | [**map[string][]map[string]interface{}**](array.md) | | [optional] +**MapMapString** | [**map[string]map[string]string**](map.md) | | [optional] +**MapMapAnytype** | [**map[string]map[string]map[string]interface{}**](map.md) | | [optional] +**Anytype1** | [**map[string]interface{}**](.md) | | [optional] +**Anytype2** | [**map[string]interface{}**](.md) | | [optional] +**Anytype3** | [**map[string]interface{}**](.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesInteger.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesInteger.md new file mode 100644 index 00000000000..34e6fca8fb0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesInteger.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesInteger + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesNumber.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesNumber.md new file mode 100644 index 00000000000..6d41fd2315c --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesNumber.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesNumber + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesObject.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesObject.md new file mode 100644 index 00000000000..b856de693b1 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesObject.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesString.md b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesString.md new file mode 100644 index 00000000000..69ad2065685 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AdditionalPropertiesString.md @@ -0,0 +1,11 @@ +# AdditionalPropertiesString + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Animal.md b/samples/client/petstore/go/go-petstore-withXml/docs/Animal.md index d7113331a60..02d23377da6 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Animal.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Animal.md @@ -1,6 +1,7 @@ # Animal ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md index 6d996803c95..0b9deb0c58a 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md @@ -7,7 +7,9 @@ Method | HTTP request | Description [**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags -# **Call123TestSpecialTags** + +## Call123TestSpecialTags + > Client Call123TestSpecialTags(ctx, body) To test special tags @@ -15,10 +17,11 @@ To test special tags and operation ID starting with number ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Client**](Client.md)| client model | ### Return type @@ -30,8 +33,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ApiResponse.md b/samples/client/petstore/go/go-petstore-withXml/docs/ApiResponse.md index f9b16338ecd..41d28fb578c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ApiResponse.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ApiResponse.md @@ -1,6 +1,7 @@ # ApiResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Code** | **int32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfArrayOfNumberOnly.md index a53147b6270..555213013b2 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfArrayOfNumberOnly.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfArrayOfNumberOnly.md @@ -1,6 +1,7 @@ # ArrayOfArrayOfNumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfNumberOnly.md b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfNumberOnly.md index 19031e76d20..56618756dd7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfNumberOnly.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayOfNumberOnly.md @@ -1,6 +1,7 @@ # ArrayOfNumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayNumber** | **[]float32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayTest.md b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayTest.md index a46d1acf665..0da0bc52d2d 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ArrayTest.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ArrayTest.md @@ -1,6 +1,7 @@ # ArrayTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayOfString** | **[]string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Capitalization.md b/samples/client/petstore/go/go-petstore-withXml/docs/Capitalization.md index ac65ee37dba..426b8eabd9b 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Capitalization.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Capitalization.md @@ -1,6 +1,7 @@ # Capitalization ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SmallCamel** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Cat.md b/samples/client/petstore/go/go-petstore-withXml/docs/Cat.md index b51d5fd2b95..1ef1f095e94 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Cat.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Cat.md @@ -1,6 +1,7 @@ # Cat ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/CatAllOf.md b/samples/client/petstore/go/go-petstore-withXml/docs/CatAllOf.md new file mode 100644 index 00000000000..c978cee0417 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/CatAllOf.md @@ -0,0 +1,11 @@ +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Category.md b/samples/client/petstore/go/go-petstore-withXml/docs/Category.md index 1440215d225..01e8344bd06 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Category.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Category.md @@ -1,6 +1,7 @@ # Category ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ClassModel.md b/samples/client/petstore/go/go-petstore-withXml/docs/ClassModel.md index 8d7a7284393..0b925cebb1f 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ClassModel.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ClassModel.md @@ -1,6 +1,7 @@ # ClassModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Class** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Client.md b/samples/client/petstore/go/go-petstore-withXml/docs/Client.md index fdf5fd9a69d..551da852eec 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Client.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Client.md @@ -1,6 +1,7 @@ # Client ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Client** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Dog.md b/samples/client/petstore/go/go-petstore-withXml/docs/Dog.md index 13c0aa28e6b..ff35dd5cdca 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Dog.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Dog.md @@ -1,6 +1,7 @@ # Dog ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/DogAllOf.md b/samples/client/petstore/go/go-petstore-withXml/docs/DogAllOf.md new file mode 100644 index 00000000000..b87153e9265 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/docs/DogAllOf.md @@ -0,0 +1,11 @@ +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/EnumArrays.md b/samples/client/petstore/go/go-petstore-withXml/docs/EnumArrays.md index 9eca8b29032..3021f881830 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/EnumArrays.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/EnumArrays.md @@ -1,6 +1,7 @@ # EnumArrays ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/EnumClass.md b/samples/client/petstore/go/go-petstore-withXml/docs/EnumClass.md index 67f017becd0..c6932388c06 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/EnumClass.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/EnumClass.md @@ -1,6 +1,7 @@ # EnumClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/EnumTest.md b/samples/client/petstore/go/go-petstore-withXml/docs/EnumTest.md index 85eab0e1d40..eeec09b66b4 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/EnumTest.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/EnumTest.md @@ -1,6 +1,7 @@ # EnumTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **EnumString** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md index e6d0dec3fe1..b7927f181e4 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md @@ -19,7 +19,9 @@ Method | HTTP request | Description [**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data -# **CreateXmlItem** + +## CreateXmlItem + > CreateXmlItem(ctx, xmlItem) creates an XmlItem @@ -27,10 +29,11 @@ this route creates an XmlItem ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**xmlItem** | [**XmlItem**](XmlItem.md)| XmlItem Body | ### Return type @@ -42,12 +45,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - - **Accept**: Not defined +- **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterBooleanSerialize -# **FakeOuterBooleanSerialize** > bool FakeOuterBooleanSerialize(ctx, optional) @@ -55,14 +62,17 @@ Test serialization of outer boolean types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.Bool**| Input boolean as post body | @@ -77,12 +87,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: */* +- **Content-Type**: Not defined +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterCompositeSerialize -# **FakeOuterCompositeSerialize** > OuterComposite FakeOuterCompositeSerialize(ctx, optional) @@ -90,14 +104,17 @@ Test serialization of object with outer number type ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | @@ -112,12 +129,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: */* +- **Content-Type**: Not defined +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterNumberSerialize -# **FakeOuterNumberSerialize** > float32 FakeOuterNumberSerialize(ctx, optional) @@ -125,14 +146,17 @@ Test serialization of outer number types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.Float32**| Input number as post body | @@ -147,12 +171,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: */* +- **Content-Type**: Not defined +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterStringSerialize -# **FakeOuterStringSerialize** > string FakeOuterStringSerialize(ctx, optional) @@ -160,14 +188,17 @@ Test serialization of outer string types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.String**| Input string as post body | @@ -182,12 +213,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: */* +- **Content-Type**: Not defined +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestBodyWithFileSchema -# **TestBodyWithFileSchema** > TestBodyWithFileSchema(ctx, body) @@ -195,10 +230,11 @@ For this test, the body for this request much reference a schema named `File`. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -210,22 +246,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestBodyWithQueryParams -# **TestBodyWithQueryParams** > TestBodyWithQueryParams(ctx, query, body) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **query** | **string**| | - **body** | [**User**](User.md)| | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**query** | **string**| | +**body** | [**User**](User.md)| | ### Return type @@ -237,12 +278,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestClientModel -# **TestClientModel** > Client TestClientModel(ctx, body) To test \"client\" model @@ -250,10 +295,11 @@ To test \"client\" model ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Client**](Client.md)| client model | ### Return type @@ -265,12 +311,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestEndpointParameters -# **TestEndpointParameters** > TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -278,18 +328,21 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **number** | **float32**| None | - **double** | **float64**| None | - **patternWithoutDelimiter** | **string**| None | - **byte_** | **string**| None | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**number** | **float32**| None | +**double** | **float64**| None | +**patternWithoutDelimiter** | **string**| None | +**byte_** | **string**| None | **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -317,12 +370,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestEnumParameters -# **TestEnumParameters** > TestEnumParameters(ctx, optional) To test enum parameters @@ -330,14 +387,17 @@ To test enum parameters ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestEnumParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) | @@ -359,12 +419,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestGroupParameters -# **TestGroupParameters** > TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional) Fake endpoint to test group parameters (optional) @@ -372,17 +436,20 @@ Fake endpoint to test group parameters (optional) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **requiredStringGroup** | **int32**| Required String in group parameters | - **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | - **requiredInt64Group** | **int64**| Required Integer in group parameters | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**requiredStringGroup** | **int32**| Required String in group parameters | +**requiredBooleanGroup** | **bool**| Required Boolean in group parameters | +**requiredInt64Group** | **int64**| Required Integer in group parameters | **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestGroupParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -402,21 +469,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestInlineAdditionalProperties -# **TestInlineAdditionalProperties** > TestInlineAdditionalProperties(ctx, param) test inline additionalProperties ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **param** | [**map[string]string**](string.md)| request body | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**param** | [**map[string]string**](string.md)| request body | ### Return type @@ -428,22 +500,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestJsonFormData -# **TestJsonFormData** > TestJsonFormData(ctx, param, param2) test json serialization of form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **param** | **string**| field1 | - **param2** | **string**| field2 | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**param** | **string**| field1 | +**param2** | **string**| field2 | ### Return type @@ -455,8 +532,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md b/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md index d9311e369db..b3cbcc2c06e 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FakeClassnameTags123Api.md @@ -7,7 +7,9 @@ Method | HTTP request | Description [**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case -# **TestClassname** + +## TestClassname + > Client TestClassname(ctx, body) To test class name in snake case @@ -15,10 +17,11 @@ To test class name in snake case ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Client**](Client.md)| client model | ### Return type @@ -30,8 +33,10 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/File.md b/samples/client/petstore/go/go-petstore-withXml/docs/File.md index e7f7d80e05d..a113b0312cd 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/File.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/File.md @@ -1,6 +1,7 @@ # File ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SourceURI** | **string** | Test capitalization | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FileSchemaTestClass.md b/samples/client/petstore/go/go-petstore-withXml/docs/FileSchemaTestClass.md index 69cbfa2c189..ae51414dd6c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FileSchemaTestClass.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FileSchemaTestClass.md @@ -1,6 +1,7 @@ # FileSchemaTestClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **File** | [**File**](File.md) | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FormatTest.md b/samples/client/petstore/go/go-petstore-withXml/docs/FormatTest.md index 5f70da85aa2..ee089a03cd7 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FormatTest.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FormatTest.md @@ -1,6 +1,7 @@ # FormatTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Integer** | **int32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/HasOnlyReadOnly.md b/samples/client/petstore/go/go-petstore-withXml/docs/HasOnlyReadOnly.md index c259e8b325a..9e2f4957359 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/HasOnlyReadOnly.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/HasOnlyReadOnly.md @@ -1,6 +1,7 @@ # HasOnlyReadOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Bar** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/List.md b/samples/client/petstore/go/go-petstore-withXml/docs/List.md index 3255fa27868..bba2e529906 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/List.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/List.md @@ -1,6 +1,7 @@ # List ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Var123List** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md b/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md index 49381ec4b85..6645e044658 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md @@ -1,6 +1,7 @@ # MapTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/go/go-petstore-withXml/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 0e5f61f6273..a2ce1068b27 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -1,6 +1,7 @@ # MixedPropertiesAndAdditionalPropertiesClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Uuid** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Model200Response.md b/samples/client/petstore/go/go-petstore-withXml/docs/Model200Response.md index c5abac20d86..27b93bd1549 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Model200Response.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Model200Response.md @@ -1,6 +1,7 @@ # Model200Response ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **int32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Name.md b/samples/client/petstore/go/go-petstore-withXml/docs/Name.md index fccddf63899..453e54d9851 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Name.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Name.md @@ -1,6 +1,7 @@ # Name ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **int32** | | diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/NumberOnly.md b/samples/client/petstore/go/go-petstore-withXml/docs/NumberOnly.md index 4d2ea1b0413..604cf37eede 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/NumberOnly.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/NumberOnly.md @@ -1,6 +1,7 @@ # NumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustNumber** | **float32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Order.md b/samples/client/petstore/go/go-petstore-withXml/docs/Order.md index befa9151a18..eeef0971005 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Order.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Order.md @@ -1,6 +1,7 @@ # Order ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/OuterComposite.md b/samples/client/petstore/go/go-petstore-withXml/docs/OuterComposite.md index 30732cf10bf..df9bce1bd90 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/OuterComposite.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/OuterComposite.md @@ -1,6 +1,7 @@ # OuterComposite ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MyNumber** | **float32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/OuterEnum.md b/samples/client/petstore/go/go-petstore-withXml/docs/OuterEnum.md index 06d413b0168..c97466159c5 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/OuterEnum.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/OuterEnum.md @@ -1,6 +1,7 @@ # OuterEnum ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Pet.md b/samples/client/petstore/go/go-petstore-withXml/docs/Pet.md index 049c82eb5a0..c48104c6397 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Pet.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Pet.md @@ -1,6 +1,7 @@ # Pet ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md index e1fffc03512..de48d4b6763 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/PetApi.md @@ -15,16 +15,19 @@ Method | HTTP request | Description [**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -# **AddPet** + +## AddPet + > AddPet(ctx, body) Add a new pet to the store ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -36,26 +39,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeletePet -# **DeletePet** > DeletePet(ctx, petId, optional) Deletes a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| Pet id to delete | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| Pet id to delete | **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a DeletePetOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -71,12 +81,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByStatus -# **FindPetsByStatus** > []Pet FindPetsByStatus(ctx, status) Finds Pets by status @@ -84,10 +98,11 @@ Multiple status values can be provided with comma separated strings ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **status** | [**[]string**](string.md)| Status values that need to be considered for filter | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**status** | [**[]string**](string.md)| Status values that need to be considered for filter | ### Return type @@ -99,12 +114,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByTags -# **FindPetsByTags** > []Pet FindPetsByTags(ctx, tags) Finds Pets by tags @@ -112,10 +131,11 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **tags** | [**[]string**](string.md)| Tags to filter by | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**tags** | [**[]string**](string.md)| Tags to filter by | ### Return type @@ -127,12 +147,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPetById -# **GetPetById** > Pet GetPetById(ctx, petId) Find pet by ID @@ -140,10 +164,11 @@ Returns a single pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to return | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to return | ### Return type @@ -155,21 +180,26 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePet -# **UpdatePet** > UpdatePet(ctx, body) Update an existing pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -181,26 +211,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePetWithForm -# **UpdatePetWithForm** > UpdatePetWithForm(ctx, petId, optional) Updates a pet in the store with form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet that needs to be updated | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet that needs to be updated | **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -217,26 +254,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadFile -# **UploadFile** > ApiResponse UploadFile(ctx, petId, optional) uploads an image ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to update | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to update | **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UploadFileOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -253,27 +297,34 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadFileWithRequiredFile -# **UploadFileWithRequiredFile** > ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional) uploads an image (required) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to update | - **requiredFile** | ***os.File*****os.File**| file to upload | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to update | +**requiredFile** | ***os.File*****os.File**| file to upload | **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -290,8 +341,10 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/ReadOnlyFirst.md b/samples/client/petstore/go/go-petstore-withXml/docs/ReadOnlyFirst.md index b3546db3cc8..3fee799f295 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/ReadOnlyFirst.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/ReadOnlyFirst.md @@ -1,6 +1,7 @@ # ReadOnlyFirst ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Bar** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Return.md b/samples/client/petstore/go/go-petstore-withXml/docs/Return.md index bcf50e4e5cd..11be0b27c50 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Return.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Return.md @@ -1,6 +1,7 @@ # Return ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Return** | **int32** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/SpecialModelName.md b/samples/client/petstore/go/go-petstore-withXml/docs/SpecialModelName.md index 7b2dfb654c0..96d7a28a409 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/SpecialModelName.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/SpecialModelName.md @@ -1,6 +1,7 @@ # SpecialModelName ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md index 88d762e0302..083ed777590 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/StoreApi.md @@ -10,7 +10,9 @@ Method | HTTP request | Description [**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet -# **DeleteOrder** + +## DeleteOrder + > DeleteOrder(ctx, orderId) Delete purchase order by ID @@ -18,10 +20,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **orderId** | **string**| ID of the order that needs to be deleted | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string**| ID of the order that needs to be deleted | ### Return type @@ -33,18 +36,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetInventory -# **GetInventory** > map[string]int32 GetInventory(ctx, ) Returns pet inventories by status Returns a map of status codes to quantities ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -57,12 +65,16 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetOrderById -# **GetOrderById** > Order GetOrderById(ctx, orderId) Find purchase order by ID @@ -70,10 +82,11 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **orderId** | **int64**| ID of pet that needs to be fetched | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **int64**| ID of pet that needs to be fetched | ### Return type @@ -85,21 +98,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## PlaceOrder -# **PlaceOrder** > Order PlaceOrder(ctx, body) Place an order for a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**Order**](Order.md)| order placed for purchasing the pet | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -111,8 +129,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/Tag.md b/samples/client/petstore/go/go-petstore-withXml/docs/Tag.md index acacb4f54a7..d6b3cc117b5 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/Tag.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/Tag.md @@ -1,6 +1,7 @@ # Tag ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderDefault.md b/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderDefault.md index 080c12a02f4..1b9f077c303 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderDefault.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderDefault.md @@ -1,6 +1,7 @@ # TypeHolderDefault ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **StringItem** | **string** | | [default to what] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderExample.md b/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderExample.md index 231c2a18722..abe85f9799d 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderExample.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/TypeHolderExample.md @@ -1,6 +1,7 @@ # TypeHolderExample ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **StringItem** | **string** | | diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/User.md b/samples/client/petstore/go/go-petstore-withXml/docs/User.md index 87e1456c8a8..7675d7ff701 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/User.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/User.md @@ -1,6 +1,7 @@ # User ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md index e57a67b7547..3201e1771dc 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/UserApi.md @@ -14,7 +14,9 @@ Method | HTTP request | Description [**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user -# **CreateUser** + +## CreateUser + > CreateUser(ctx, body) Create user @@ -22,10 +24,11 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**User**](User.md)| Created user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**User**](User.md)| Created user object | ### Return type @@ -37,21 +40,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithArrayInput -# **CreateUsersWithArrayInput** > CreateUsersWithArrayInput(ctx, body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**[]User**](array.md)| List of user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**[]User**](User.md)| List of user object | ### Return type @@ -63,21 +71,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithListInput -# **CreateUsersWithListInput** > CreateUsersWithListInput(ctx, body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **body** | [**[]User**](array.md)| List of user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**body** | [**[]User**](User.md)| List of user object | ### Return type @@ -89,12 +102,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUser -# **DeleteUser** > DeleteUser(ctx, username) Delete user @@ -102,10 +119,11 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The name that needs to be deleted | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be deleted | ### Return type @@ -117,21 +135,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserByName -# **GetUserByName** > User GetUserByName(ctx, username) Get user by user name ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The name that needs to be fetched. Use user1 for testing. | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -143,22 +166,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LoginUser -# **LoginUser** > string LoginUser(ctx, username, password) Logs user into the system ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The user name for login | - **password** | **string**| The password for login in clear text | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The user name for login | +**password** | **string**| The password for login in clear text | ### Return type @@ -170,16 +198,21 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LogoutUser -# **LogoutUser** > LogoutUser(ctx, ) Logs out current logged in user session ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -192,12 +225,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUser -# **UpdateUser** > UpdateUser(ctx, username, body) Updated user @@ -205,11 +242,12 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| name that need to be deleted | +**body** | [**User**](User.md)| Updated user object | ### Return type @@ -221,8 +259,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/XmlItem.md b/samples/client/petstore/go/go-petstore-withXml/docs/XmlItem.md index 573fac8e2d5..8a9c2dc0b50 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/XmlItem.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/XmlItem.md @@ -1,6 +1,7 @@ # XmlItem ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AttributeString** | **string** | | [optional] diff --git a/samples/client/petstore/go/go-petstore-withXml/go.mod b/samples/client/petstore/go/go-petstore-withXml/go.mod new file mode 100644 index 00000000000..199809ed706 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/go.mod @@ -0,0 +1,6 @@ +module github.com/GIT_USER_ID/GIT_REPO_ID + +require ( + github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6 + golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a +) diff --git a/samples/client/petstore/go/go-petstore-withXml/go.sum b/samples/client/petstore/go/go-petstore-withXml/go.sum new file mode 100644 index 00000000000..e3c16fef3ac --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/go.sum @@ -0,0 +1,11 @@ +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/antihax/optional v0.0.0-20180406194304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a h1:tImsplftrFpALCYumobsd0K86vlAs/eXGFms2txfJfA= +golang.org/x/oauth2 v0.0.0-20190402181905-9f3314589c9a/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_any_type.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_any_type.go new file mode 100644 index 00000000000..6977ea451be --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_any_type.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesAnyType struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_array.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_array.go new file mode 100644 index 00000000000..ef3055a02b3 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_array.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesArray struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_boolean.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_boolean.go new file mode 100644 index 00000000000..6cd68b36627 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_boolean.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesBoolean struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go index afa3de3d955..363a62f7a3e 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_class.go @@ -11,6 +11,15 @@ package petstore type AdditionalPropertiesClass struct { - MapProperty map[string]string `json:"map_property,omitempty" xml:"map_property"` - MapOfMapProperty map[string]map[string]string `json:"map_of_map_property,omitempty" xml:"map_of_map_property"` + MapString map[string]string `json:"map_string,omitempty" xml:"map_string"` + MapNumber map[string]float32 `json:"map_number,omitempty" xml:"map_number"` + MapInteger map[string]int32 `json:"map_integer,omitempty" xml:"map_integer"` + MapBoolean map[string]bool `json:"map_boolean,omitempty" xml:"map_boolean"` + MapArrayInteger map[string][]int32 `json:"map_array_integer,omitempty" xml:"map_array_integer"` + MapArrayAnytype map[string][]map[string]interface{} `json:"map_array_anytype,omitempty" xml:"map_array_anytype"` + MapMapString map[string]map[string]string `json:"map_map_string,omitempty" xml:"map_map_string"` + MapMapAnytype map[string]map[string]map[string]interface{} `json:"map_map_anytype,omitempty" xml:"map_map_anytype"` + Anytype1 map[string]interface{} `json:"anytype_1,omitempty" xml:"anytype_1"` + Anytype2 map[string]interface{} `json:"anytype_2,omitempty" xml:"anytype_2"` + Anytype3 map[string]interface{} `json:"anytype_3,omitempty" xml:"anytype_3"` } diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_integer.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_integer.go new file mode 100644 index 00000000000..7878ce4a066 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_integer.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesInteger struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_number.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_number.go new file mode 100644 index 00000000000..f95c1a6e3d6 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_number.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesNumber struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_object.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_object.go new file mode 100644 index 00000000000..e69e5153748 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_object.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesObject struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_string.go b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_string.go new file mode 100644 index 00000000000..7fb9acc4f2a --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_additional_properties_string.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type AdditionalPropertiesString struct { + Name string `json:"name,omitempty" xml:"name"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_cat_all_of.go b/samples/client/petstore/go/go-petstore-withXml/model_cat_all_of.go new file mode 100644 index 00000000000..c01d44785e9 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_cat_all_of.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type CatAllOf struct { + Declawed bool `json:"declawed,omitempty" xml:"declawed"` +} diff --git a/samples/client/petstore/go/go-petstore-withXml/model_dog_all_of.go b/samples/client/petstore/go/go-petstore-withXml/model_dog_all_of.go new file mode 100644 index 00000000000..a679641f749 --- /dev/null +++ b/samples/client/petstore/go/go-petstore-withXml/model_dog_all_of.go @@ -0,0 +1,15 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + */ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package petstore + +type DogAllOf struct { + Breed string `json:"breed,omitempty" xml:"breed"` +} diff --git a/samples/client/petstore/go/go-petstore/api_another_fake.go b/samples/client/petstore/go/go-petstore/api_another_fake.go index eaf9bfd49af..152bf5be285 100644 --- a/samples/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore/api_another_fake.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -33,7 +32,7 @@ To test special tags and operation ID starting with number */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index 90af0bcb03f..27c3ae978ba 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "github.com/antihax/optional" "os" ) @@ -34,7 +33,7 @@ this route creates an XmlItem */ func (a *FakeApiService) CreateXmlItem(ctx context.Context, xmlItem XmlItem) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -109,7 +108,7 @@ type FakeOuterBooleanSerializeOpts struct { func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -207,7 +206,7 @@ type FakeOuterCompositeSerializeOpts struct { func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -309,7 +308,7 @@ type FakeOuterNumberSerializeOpts struct { func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -407,7 +406,7 @@ type FakeOuterStringSerializeOpts struct { func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -498,7 +497,7 @@ For this test, the body for this request much reference a schema named `Fil */ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, body FileSchemaTestClass) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -566,7 +565,7 @@ FakeApiService */ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -636,7 +635,7 @@ To test \"client\" model */ func (a *FakeApiService) TestClientModel(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -752,7 +751,7 @@ type TestEndpointParametersOpts struct { func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -896,7 +895,7 @@ type TestEnumParametersOpts struct { func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -999,7 +998,7 @@ type TestGroupParametersOpts struct { func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1076,7 +1075,7 @@ FakeApiService test inline additionalProperties */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, param map[string]string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1144,7 +1143,7 @@ FakeApiService test json serialization of form data */ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go index 784a54e5e7c..6c04d55739a 100644 --- a/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go +++ b/samples/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -33,7 +32,7 @@ To test class name in snake case */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, body Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/api_pet.go b/samples/client/petstore/go/go-petstore/api_pet.go index e3cbb84b587..243d16197f0 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" "github.com/antihax/optional" "os" ) @@ -34,7 +34,7 @@ PetApiService Add a new pet to the store */ func (a *PetApiService) AddPet(ctx context.Context, body Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -108,7 +108,7 @@ type DeletePetOpts struct { func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -179,7 +179,7 @@ Multiple status values can be provided with comma separated strings */ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -267,7 +267,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 */ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -355,7 +355,7 @@ Returns a single pet */ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -453,7 +453,7 @@ PetApiService Update an existing pet */ func (a *PetApiService) UpdatePet(ctx context.Context, body Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -529,7 +529,7 @@ type UpdatePetWithFormOpts struct { func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -611,7 +611,7 @@ type UploadFileOpts struct { func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -724,7 +724,7 @@ type UploadFileWithRequiredFileOpts struct { func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/api_store.go b/samples/client/petstore/go/go-petstore/api_store.go index 2b195275dbc..3211860d49c 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -33,7 +33,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -100,7 +100,7 @@ Returns a map of status codes to quantities */ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -199,7 +199,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other val */ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -292,7 +292,7 @@ StoreApiService Place an order for a pet */ func (a *StoreApiService) PlaceOrder(ctx context.Context, body Order) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/api_user.go b/samples/client/petstore/go/go-petstore/api_user.go index 2e349b1d29d..6a7d2b1195a 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -33,7 +33,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -100,7 +100,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, body []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -167,7 +167,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, body []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -235,7 +235,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -302,7 +302,7 @@ UserApiService Get user by user name */ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -390,7 +390,7 @@ UserApiService Logs user into the system */ func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -476,7 +476,7 @@ UserApiService Logs out current logged in user session */ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -543,7 +543,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) UpdateUser(ctx context.Context, username string, body User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index e057b745291..e67a99338b8 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -255,6 +255,16 @@ func (c *APIClient) prepareRequest( return nil, err } + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + // Adding Query Param query := url.Query() for k, v := range queryParams { @@ -285,11 +295,6 @@ func (c *APIClient) prepareRequest( localVarRequest.Header = headers } - // Override request host, if applicable - if c.cfg.Host != "" { - localVarRequest.Host = c.cfg.Host - } - // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) diff --git a/samples/client/petstore/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md index ea19e0e716f..3201e1771dc 100644 --- a/samples/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -59,7 +59,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](array.md)| List of user object | +**body** | [**[]User**](User.md)| List of user object | ### Return type @@ -90,7 +90,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. -**body** | [**[]User**](array.md)| List of user object | +**body** | [**[]User**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index 0e23ca936e3..969fab1f667 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -14,12 +14,14 @@ import ( var client *sw.APIClient -const testHost = "testhost" +const testHost = "petstore.swagger.io:80" +const testScheme = "http" func TestMain(m *testing.M) { cfg := sw.NewConfiguration() cfg.AddDefaultHeader("testheader", "testvalue") cfg.Host = testHost + cfg.Scheme = testScheme client = sw.NewAPIClient(cfg) retCode := m.Run() os.Exit(retCode) @@ -32,8 +34,7 @@ func TestAddPet(t *testing.T) { r, err := client.PetApi.AddPet(context.Background(), newPet) if err != nil { - t.Errorf("Error while adding pet") - t.Log(err) + t.Fatalf("Error while adding pet: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -44,8 +45,7 @@ func TestFindPetsByStatusWithMissingParam(t *testing.T) { _, r, err := client.PetApi.FindPetsByStatus(context.Background(), nil) if err != nil { - t.Errorf("Error while testing TestFindPetsByStatusWithMissingParam") - t.Log(err) + t.Fatalf("Error while testing TestFindPetsByStatusWithMissingParam: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -66,8 +66,7 @@ func TestGetPetByIdWithInvalidID(t *testing.T) { a.Contains(assertedError.Error(), "Not Found") } else if err != nil { - t.Errorf("Error while getting pet by invalid id") - t.Log(err) + t.Fatalf("Error while getting pet by invalid id: %v", err) t.Log(r) } else { t.Log(resp) @@ -80,8 +79,7 @@ func TestUpdatePetWithForm(t *testing.T) { Status: optional.NewString("available"), }) if err != nil { - t.Errorf("Error while updating pet by id") - t.Log(err) + t.Fatalf("Error while updating pet by id: %v", err) t.Log(r) } if r.StatusCode != 200 { @@ -96,8 +94,7 @@ func TestFindPetsByTag(t *testing.T) { var found = false resp, r, err := client.PetApi.FindPetsByTags(context.Background(), []string{"tag2"}) if err != nil { - t.Errorf("Error while getting pet by tag") - t.Log(err) + t.Fatalf("Error while getting pet by tag: %v", err) t.Log(r) } else { if len(resp) == 0 { @@ -126,8 +123,7 @@ func TestFindPetsByTag(t *testing.T) { func TestFindPetsByStatus(t *testing.T) { resp, r, err := client.PetApi.FindPetsByStatus(context.Background(), []string{"available"}) if err != nil { - t.Errorf("Error while getting pet by id") - t.Log(err) + t.Fatalf("Error while getting pet by id: %v", err) t.Log(r) } else { if len(resp) == 0 { @@ -154,8 +150,7 @@ func TestUploadFile(t *testing.T) { }) if err != nil { - t.Errorf("Error while uploading file") - t.Log(err) + t.Fatalf("Error while uploading file: %v", err) } if r.StatusCode != 200 { @@ -174,8 +169,7 @@ func TestUploadFileRequired(t *testing.T) { }) if err != nil { - t.Errorf("Error while uploading file") - t.Log(err) + t.Fatalf("Error while uploading file: %v", err) } if r.StatusCode != 200 { @@ -187,8 +181,7 @@ func TestDeletePet(t *testing.T) { r, err := client.PetApi.DeletePet(context.Background(), 12830, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -269,8 +262,7 @@ func waitOnFunctions(t *testing.T, errc chan error, n int) { for i := 0; i < n; i++ { err := <-errc if err != nil { - t.Errorf("Error performing concurrent test") - t.Log(err) + t.Fatalf("Error performing concurrent test: %v", err) } } } @@ -279,8 +271,7 @@ func deletePet(t *testing.T, id int64) { r, err := client.PetApi.DeletePet(context.Background(), id, nil) if err != nil { - t.Errorf("Error while deleting pet by id") - t.Log(err) + t.Fatalf("Error while deleting pet by id: %v", err) } if r.StatusCode != 200 { t.Log(r) @@ -291,8 +282,7 @@ func isPetCorrect(t *testing.T, id int64, name string, status string) { assert := assert.New(t) resp, r, err := client.PetApi.GetPetById(context.Background(), id) if err != nil { - t.Errorf("Error while getting pet by id") - t.Log(err) + t.Fatalf("Error while getting pet by id: %v", err) } else { assert.Equal(resp.Id, int64(id), "Pet id should be equal") assert.Equal(resp.Name, name, fmt.Sprintf("Pet name should be %s", name)) diff --git a/samples/client/petstore/go/store_api_test.go b/samples/client/petstore/go/store_api_test.go index 72191d0dd61..3088adf7b40 100644 --- a/samples/client/petstore/go/store_api_test.go +++ b/samples/client/petstore/go/store_api_test.go @@ -28,9 +28,8 @@ func TestPlaceOrder(t *testing.T) { MatchString(err.Error()) { t.Log("Skipping error for parsing time with `+0000` UTC offset as Petstore Test Server does not return valid RFC 3339 datetime") } else { - t.Errorf("Error while placing order") + t.Fatalf("Error while placing order: %v", err) } - t.Log(err) } if r.StatusCode != 200 { t.Log(r) diff --git a/samples/client/petstore/go/user_api_test.go b/samples/client/petstore/go/user_api_test.go index 67995a160ad..012c608fab6 100644 --- a/samples/client/petstore/go/user_api_test.go +++ b/samples/client/petstore/go/user_api_test.go @@ -23,8 +23,7 @@ func TestCreateUser(t *testing.T) { apiResponse, err := client.UserApi.CreateUser(context.Background(), newUser) if err != nil { - t.Errorf("Error while adding user") - t.Log(err) + t.Fatalf("Error while adding user: %v", err) } if apiResponse.StatusCode != 200 { t.Log(apiResponse) @@ -58,8 +57,7 @@ func TestCreateUsersWithArrayInput(t *testing.T) { apiResponse, err := client.UserApi.CreateUsersWithArrayInput(context.Background(), newUsers) if err != nil { - t.Errorf("Error while adding users") - t.Log(err) + t.Fatalf("Error while adding users: %v", err) } if apiResponse.StatusCode != 200 { t.Log(apiResponse) @@ -84,8 +82,7 @@ func TestGetUserByName(t *testing.T) { resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher") if err != nil { - t.Errorf("Error while getting user by id") - t.Log(err) + t.Fatalf("Error while getting user by id: %v", err) } else { assert.Equal(resp.Id, int64(1000), "User id should be equal") assert.Equal(resp.Username, "gopher", "User name should be gopher") @@ -102,8 +99,7 @@ func TestGetUserByNameWithInvalidID(t *testing.T) { if apiResponse != nil && apiResponse.StatusCode == 404 { return // This is a pass condition. API will return with a 404 error. } else if err != nil { - t.Errorf("Error while getting user by invalid id") - t.Log(err) + t.Fatalf("Error while getting user by invalid id: %v", err) t.Log(apiResponse) } else { t.Log(resp) @@ -128,8 +124,7 @@ func TestUpdateUser(t *testing.T) { apiResponse, err := client.UserApi.UpdateUser(context.Background(), "gopher", newUser) if err != nil { - t.Errorf("Error while deleting user by id") - t.Log(err) + t.Fatalf("Error while deleting user by id: %v", err) } if apiResponse.StatusCode != 200 { t.Log(apiResponse) @@ -138,8 +133,7 @@ func TestUpdateUser(t *testing.T) { //verify changings are correct resp, apiResponse, err := client.UserApi.GetUserByName(context.Background(), "gopher") if err != nil { - t.Errorf("Error while getting user by id") - t.Log(err) + t.Fatalf("Error while getting user by id: %v", err) } else { assert.Equal(resp.Id, int64(1000), "User id should be equal") assert.Equal(resp.FirstName, "gopher20", "User name should be gopher") @@ -151,8 +145,7 @@ func TestDeleteUser(t *testing.T) { apiResponse, err := client.UserApi.DeleteUser(context.Background(), "gopher") if err != nil { - t.Errorf("Error while deleting user") - t.Log(err) + t.Fatalf("Error while deleting user: %v", err) } if apiResponse.StatusCode != 200 { t.Log(apiResponse) diff --git a/samples/client/petstore/java/google-api-client/docs/AnotherFakeApi.md b/samples/client/petstore/java/google-api-client/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/google-api-client/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/google-api-client/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/google-api-client/docs/FakeApi.md b/samples/client/petstore/java/google-api-client/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/google-api-client/docs/FakeApi.md +++ b/samples/client/petstore/java/google-api-client/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/google-api-client/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/google-api-client/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/google-api-client/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/google-api-client/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/google-api-client/docs/PetApi.md b/samples/client/petstore/java/google-api-client/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/google-api-client/docs/PetApi.md +++ b/samples/client/petstore/java/google-api-client/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/google-api-client/docs/StoreApi.md b/samples/client/petstore/java/google-api-client/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/google-api-client/docs/StoreApi.md +++ b/samples/client/petstore/java/google-api-client/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/google-api-client/docs/UserApi.md b/samples/client/petstore/java/google-api-client/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/google-api-client/docs/UserApi.md +++ b/samples/client/petstore/java/google-api-client/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey1/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey1/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/jersey1/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey1/docs/FakeApi.md b/samples/client/petstore/java/jersey1/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey1/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey1/docs/PetApi.md b/samples/client/petstore/java/jersey1/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/jersey1/docs/PetApi.md +++ b/samples/client/petstore/java/jersey1/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey1/docs/StoreApi.md b/samples/client/petstore/java/jersey1/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/jersey1/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey1/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/jersey1/docs/UserApi.md b/samples/client/petstore/java/jersey1/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/jersey1/docs/UserApi.md +++ b/samples/client/petstore/java/jersey1/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md b/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index 5c04d212a43..cb62cae054d 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -151,6 +151,15 @@ jar + + + + http.response.details + a + Http Response Details: + + + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java index 89c2a8f51dd..2c65b8884f0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/ApiClient.java @@ -784,6 +784,8 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 5f60e6433d1..227f00969d0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -41,6 +41,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client call123testSpecialTags(Client body) throws ApiException { return call123testSpecialTagsWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java index 7ee000303b9..70b4c329d61 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java @@ -48,6 +48,11 @@ public class FakeApi { * this route creates an XmlItem * @param xmlItem XmlItem Body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void createXmlItem(XmlItem xmlItem) throws ApiException { @@ -58,7 +63,13 @@ public class FakeApi { * creates an XmlItem * this route creates an XmlItem * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { Object localVarPostBody = xmlItem; @@ -100,6 +111,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return Boolean * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); @@ -111,6 +127,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return ApiResponse<Boolean> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { Object localVarPostBody = body; @@ -147,6 +168,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); @@ -158,6 +184,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { Object localVarPostBody = body; @@ -194,6 +225,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return BigDecimal * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { return fakeOuterNumberSerializeWithHttpInfo(body).getData(); @@ -205,6 +241,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return ApiResponse<BigDecimal> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { Object localVarPostBody = body; @@ -241,6 +282,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public String fakeOuterStringSerialize(String body) throws ApiException { return fakeOuterStringSerializeWithHttpInfo(body).getData(); @@ -252,6 +298,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { Object localVarPostBody = body; @@ -287,6 +338,11 @@ public class FakeApi { * For this test, the body for this request much reference a schema named `File`. * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { @@ -297,7 +353,13 @@ public class FakeApi { * * For this test, the body for this request much reference a schema named `File`. * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { Object localVarPostBody = body; @@ -339,6 +401,11 @@ public class FakeApi { * @param query (required) * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithQueryParams(String query, User body) throws ApiException { @@ -350,7 +417,13 @@ public class FakeApi { * * @param query (required) * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { Object localVarPostBody = body; @@ -398,6 +471,11 @@ public class FakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClientModel(Client body) throws ApiException { return testClientModelWithHttpInfo(body).getData(); @@ -409,6 +487,11 @@ public class FakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; @@ -462,6 +545,12 @@ public class FakeApi { * @param password None (optional) * @param paramCallback None (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -485,7 +574,14 @@ public class FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = new Object(); @@ -576,6 +672,12 @@ if (paramCallback != null) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { @@ -593,7 +695,14 @@ if (paramCallback != null) * @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { Object localVarPostBody = new Object(); @@ -646,6 +755,11 @@ if (enumFormString != null) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { @@ -661,7 +775,13 @@ if (enumFormString != null) * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { Object localVarPostBody = new Object(); @@ -720,6 +840,11 @@ if (booleanGroup != null) * * @param param request body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testInlineAdditionalProperties(Map param) throws ApiException { @@ -730,7 +855,13 @@ if (booleanGroup != null) * test inline additionalProperties * * @param param request body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { Object localVarPostBody = param; @@ -772,6 +903,11 @@ if (booleanGroup != null) * @param param field1 (required) * @param param2 field2 (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testJsonFormData(String param, String param2) throws ApiException { @@ -783,7 +919,13 @@ if (booleanGroup != null) * * @param param field1 (required) * @param param2 field2 (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 0bb82d50ca0..1d2ba11a21d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -41,6 +41,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClassname(Client body) throws ApiException { return testClassnameWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java index dad8fa34339..22a80aefe3a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java @@ -42,6 +42,12 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public void addPet(Pet body) throws ApiException { @@ -52,7 +58,14 @@ public class PetApi { * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -94,6 +107,12 @@ public class PetApi { * @param petId Pet id to delete (required) * @param apiKey (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public void deletePet(Long petId, String apiKey) throws ApiException { @@ -105,7 +124,14 @@ public class PetApi { * * @param petId Pet id to delete (required) * @param apiKey (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { Object localVarPostBody = new Object(); @@ -150,6 +176,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public List findPetsByStatus(List status) throws ApiException { return findPetsByStatusWithHttpInfo(status).getData(); @@ -161,6 +193,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { Object localVarPostBody = new Object(); @@ -203,6 +241,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -216,6 +260,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -260,6 +310,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public Pet getPetById(Long petId) throws ApiException { return getPetByIdWithHttpInfo(petId).getData(); @@ -271,6 +328,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return ApiResponse<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { Object localVarPostBody = new Object(); @@ -312,6 +376,14 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public void updatePet(Pet body) throws ApiException { @@ -322,7 +394,16 @@ public class PetApi { * Update an existing pet * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -365,6 +446,11 @@ public class PetApi { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -377,7 +463,13 @@ public class PetApi { * @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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { Object localVarPostBody = new Object(); @@ -426,6 +518,11 @@ if (status != null) * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); @@ -439,6 +536,11 @@ if (status != null) * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = new Object(); @@ -487,6 +589,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); @@ -500,6 +607,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java index 91aaa01157d..84c59b439eb 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/StoreApi.java @@ -40,6 +40,12 @@ public class StoreApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public void deleteOrder(String orderId) throws ApiException { @@ -50,7 +56,14 @@ public class StoreApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -92,6 +105,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return Map<String, Integer> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Map getInventory() throws ApiException { return getInventoryWithHttpInfo().getData(); @@ -102,6 +120,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return ApiResponse<Map<String, Integer>> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -138,6 +161,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public Order getOrderById(Long orderId) throws ApiException { return getOrderByIdWithHttpInfo(orderId).getData(); @@ -149,6 +179,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -191,6 +228,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public Order placeOrder(Order body) throws ApiException { return placeOrderWithHttpInfo(body).getData(); @@ -202,6 +245,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java index a91765dfdb9..1573bbde1ca 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/UserApi.java @@ -40,6 +40,11 @@ public class UserApi { * This can only be done by the logged in user. * @param body Created user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUser(User body) throws ApiException { @@ -50,7 +55,13 @@ public class UserApi { * Create user * This can only be done by the logged in user. * @param body Created user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { Object localVarPostBody = body; @@ -91,6 +102,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithArrayInput(List body) throws ApiException { @@ -101,7 +117,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -142,6 +164,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithListInput(List body) throws ApiException { @@ -152,7 +179,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -193,6 +226,12 @@ public class UserApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void deleteUser(String username) throws ApiException { @@ -203,7 +242,14 @@ public class UserApi { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -246,6 +292,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public User getUserByName(String username) throws ApiException { return getUserByNameWithHttpInfo(username).getData(); @@ -257,6 +310,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse<User> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -300,6 +360,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public String loginUser(String username, String password) throws ApiException { return loginUserWithHttpInfo(username, password).getData(); @@ -312,6 +378,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { Object localVarPostBody = new Object(); @@ -358,6 +430,11 @@ public class UserApi { * Logs out current logged in user session * * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void logoutUser() throws ApiException { @@ -367,7 +444,13 @@ public class UserApi { /** * Logs out current logged in user session * + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse logoutUserWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -404,6 +487,12 @@ public class UserApi { * @param username name that need to be deleted (required) * @param body Updated user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public void updateUser(String username, User body) throws ApiException { @@ -415,7 +504,14 @@ public class UserApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java index 45e8e2e1b63..a8d3853b590 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -58,7 +58,7 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -96,7 +96,7 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java index e757f452e94..662427bb0ad 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumClass.java @@ -52,7 +52,7 @@ public enum EnumClass { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java index 8f94eabb281..54603549196 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java @@ -59,7 +59,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -99,7 +99,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -137,7 +137,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -175,7 +175,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java index a73986fa652..c140f59e870 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java @@ -62,7 +62,7 @@ public class MapTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java index 875c0fec717..2879cd2f5aa 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java @@ -71,7 +71,7 @@ public class Order { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java index 82330046329..46c0003b4e6 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -52,7 +52,7 @@ public enum OuterEnum { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java index 502673e1550..2bcbda44b2a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java @@ -77,7 +77,7 @@ public class Pet { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java8/docs/PetApi.md b/samples/client/petstore/java/jersey2-java8/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2-java8/docs/StoreApi.md b/samples/client/petstore/java/jersey2-java8/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index 5accccfcede..204ead7705d 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -151,6 +151,15 @@ jar + + + + http.response.details + a + Http Response Details: + + + @@ -207,6 +216,11 @@ jersey-client ${jersey-version}
+ + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + org.glassfish.jersey.media jersey-media-multipart diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java index 81c14285e6b..4a03feb3b8f 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/ApiClient.java @@ -787,6 +787,8 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 5f60e6433d1..227f00969d0 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -41,6 +41,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client call123testSpecialTags(Client body) throws ApiException { return call123testSpecialTagsWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index 7ed375ab181..ec5b45d4ec3 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -48,6 +48,11 @@ public class FakeApi { * this route creates an XmlItem * @param xmlItem XmlItem Body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void createXmlItem(XmlItem xmlItem) throws ApiException { @@ -58,7 +63,13 @@ public class FakeApi { * creates an XmlItem * this route creates an XmlItem * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { Object localVarPostBody = xmlItem; @@ -100,6 +111,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return Boolean * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); @@ -111,6 +127,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return ApiResponse<Boolean> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { Object localVarPostBody = body; @@ -147,6 +168,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); @@ -158,6 +184,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { Object localVarPostBody = body; @@ -194,6 +225,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return BigDecimal * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { return fakeOuterNumberSerializeWithHttpInfo(body).getData(); @@ -205,6 +241,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return ApiResponse<BigDecimal> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { Object localVarPostBody = body; @@ -241,6 +282,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public String fakeOuterStringSerialize(String body) throws ApiException { return fakeOuterStringSerializeWithHttpInfo(body).getData(); @@ -252,6 +298,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { Object localVarPostBody = body; @@ -287,6 +338,11 @@ public class FakeApi { * For this test, the body for this request much reference a schema named `File`. * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { @@ -297,7 +353,13 @@ public class FakeApi { * * For this test, the body for this request much reference a schema named `File`. * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { Object localVarPostBody = body; @@ -339,6 +401,11 @@ public class FakeApi { * @param query (required) * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithQueryParams(String query, User body) throws ApiException { @@ -350,7 +417,13 @@ public class FakeApi { * * @param query (required) * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { Object localVarPostBody = body; @@ -398,6 +471,11 @@ public class FakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClientModel(Client body) throws ApiException { return testClientModelWithHttpInfo(body).getData(); @@ -409,6 +487,11 @@ public class FakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; @@ -462,6 +545,12 @@ public class FakeApi { * @param password None (optional) * @param paramCallback None (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -485,7 +574,14 @@ public class FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = new Object(); @@ -576,6 +672,12 @@ if (paramCallback != null) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { @@ -593,7 +695,14 @@ if (paramCallback != null) * @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { Object localVarPostBody = new Object(); @@ -646,6 +755,11 @@ if (enumFormString != null) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { @@ -661,7 +775,13 @@ if (enumFormString != null) * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { Object localVarPostBody = new Object(); @@ -720,6 +840,11 @@ if (booleanGroup != null) * * @param param request body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testInlineAdditionalProperties(Map param) throws ApiException { @@ -730,7 +855,13 @@ if (booleanGroup != null) * test inline additionalProperties * * @param param request body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { Object localVarPostBody = param; @@ -772,6 +903,11 @@ if (booleanGroup != null) * @param param field1 (required) * @param param2 field2 (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testJsonFormData(String param, String param2) throws ApiException { @@ -783,7 +919,13 @@ if (booleanGroup != null) * * @param param field1 (required) * @param param2 field2 (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 0bb82d50ca0..1d2ba11a21d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -41,6 +41,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClassname(Client body) throws ApiException { return testClassnameWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index dad8fa34339..22a80aefe3a 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -42,6 +42,12 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public void addPet(Pet body) throws ApiException { @@ -52,7 +58,14 @@ public class PetApi { * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -94,6 +107,12 @@ public class PetApi { * @param petId Pet id to delete (required) * @param apiKey (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public void deletePet(Long petId, String apiKey) throws ApiException { @@ -105,7 +124,14 @@ public class PetApi { * * @param petId Pet id to delete (required) * @param apiKey (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { Object localVarPostBody = new Object(); @@ -150,6 +176,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public List findPetsByStatus(List status) throws ApiException { return findPetsByStatusWithHttpInfo(status).getData(); @@ -161,6 +193,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { Object localVarPostBody = new Object(); @@ -203,6 +241,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -216,6 +260,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -260,6 +310,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public Pet getPetById(Long petId) throws ApiException { return getPetByIdWithHttpInfo(petId).getData(); @@ -271,6 +328,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return ApiResponse<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { Object localVarPostBody = new Object(); @@ -312,6 +376,14 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public void updatePet(Pet body) throws ApiException { @@ -322,7 +394,16 @@ public class PetApi { * Update an existing pet * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -365,6 +446,11 @@ public class PetApi { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -377,7 +463,13 @@ public class PetApi { * @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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { Object localVarPostBody = new Object(); @@ -426,6 +518,11 @@ if (status != null) * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); @@ -439,6 +536,11 @@ if (status != null) * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = new Object(); @@ -487,6 +589,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); @@ -500,6 +607,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java index 91aaa01157d..84c59b439eb 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/StoreApi.java @@ -40,6 +40,12 @@ public class StoreApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public void deleteOrder(String orderId) throws ApiException { @@ -50,7 +56,14 @@ public class StoreApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -92,6 +105,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return Map<String, Integer> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Map getInventory() throws ApiException { return getInventoryWithHttpInfo().getData(); @@ -102,6 +120,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return ApiResponse<Map<String, Integer>> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -138,6 +161,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public Order getOrderById(Long orderId) throws ApiException { return getOrderByIdWithHttpInfo(orderId).getData(); @@ -149,6 +179,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -191,6 +228,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public Order placeOrder(Order body) throws ApiException { return placeOrderWithHttpInfo(body).getData(); @@ -202,6 +245,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java index a91765dfdb9..1573bbde1ca 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/UserApi.java @@ -40,6 +40,11 @@ public class UserApi { * This can only be done by the logged in user. * @param body Created user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUser(User body) throws ApiException { @@ -50,7 +55,13 @@ public class UserApi { * Create user * This can only be done by the logged in user. * @param body Created user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { Object localVarPostBody = body; @@ -91,6 +102,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithArrayInput(List body) throws ApiException { @@ -101,7 +117,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -142,6 +164,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithListInput(List body) throws ApiException { @@ -152,7 +179,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -193,6 +226,12 @@ public class UserApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void deleteUser(String username) throws ApiException { @@ -203,7 +242,14 @@ public class UserApi { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -246,6 +292,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public User getUserByName(String username) throws ApiException { return getUserByNameWithHttpInfo(username).getData(); @@ -257,6 +310,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse<User> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -300,6 +360,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public String loginUser(String username, String password) throws ApiException { return loginUserWithHttpInfo(username, password).getData(); @@ -312,6 +378,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { Object localVarPostBody = new Object(); @@ -358,6 +430,11 @@ public class UserApi { * Logs out current logged in user session * * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void logoutUser() throws ApiException { @@ -367,7 +444,13 @@ public class UserApi { /** * Logs out current logged in user session * + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse logoutUserWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -404,6 +487,12 @@ public class UserApi { * @param username name that need to be deleted (required) * @param body Updated user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public void updateUser(String username, User body) throws ApiException { @@ -415,7 +504,14 @@ public class UserApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md b/samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/jersey2/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2/docs/PetApi.md b/samples/client/petstore/java/jersey2/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/jersey2/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/jersey2/docs/StoreApi.md b/samples/client/petstore/java/jersey2/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/jersey2/docs/StoreApi.md +++ b/samples/client/petstore/java/jersey2/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/jersey2/docs/UserApi.md b/samples/client/petstore/java/jersey2/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/jersey2/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index bb1a916c1e4..60ace064510 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -151,6 +151,15 @@ jar + + + + http.response.details + a + Http Response Details: + + + @@ -207,6 +216,11 @@ jersey-client ${jersey-version}
+ + org.glassfish.jersey.inject + jersey-hk2 + ${jersey-version} + org.glassfish.jersey.media jersey-media-multipart diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java index 81c14285e6b..4a03feb3b8f 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/ApiClient.java @@ -787,6 +787,8 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ protected void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index 5f60e6433d1..227f00969d0 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -41,6 +41,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client call123testSpecialTags(Client body) throws ApiException { return call123testSpecialTagsWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class AnotherFakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse call123testSpecialTagsWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java index 7ee000303b9..70b4c329d61 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -48,6 +48,11 @@ public class FakeApi { * this route creates an XmlItem * @param xmlItem XmlItem Body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void createXmlItem(XmlItem xmlItem) throws ApiException { @@ -58,7 +63,13 @@ public class FakeApi { * creates an XmlItem * this route creates an XmlItem * @param xmlItem XmlItem Body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse createXmlItemWithHttpInfo(XmlItem xmlItem) throws ApiException { Object localVarPostBody = xmlItem; @@ -100,6 +111,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return Boolean * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { return fakeOuterBooleanSerializeWithHttpInfo(body).getData(); @@ -111,6 +127,11 @@ public class FakeApi { * @param body Input boolean as post body (optional) * @return ApiResponse<Boolean> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output boolean -
*/ public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { Object localVarPostBody = body; @@ -147,6 +168,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return OuterComposite * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { return fakeOuterCompositeSerializeWithHttpInfo(body).getData(); @@ -158,6 +184,11 @@ public class FakeApi { * @param body Input composite as post body (optional) * @return ApiResponse<OuterComposite> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output composite -
*/ public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { Object localVarPostBody = body; @@ -194,6 +225,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return BigDecimal * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { return fakeOuterNumberSerializeWithHttpInfo(body).getData(); @@ -205,6 +241,11 @@ public class FakeApi { * @param body Input number as post body (optional) * @return ApiResponse<BigDecimal> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output number -
*/ public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { Object localVarPostBody = body; @@ -241,6 +282,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public String fakeOuterStringSerialize(String body) throws ApiException { return fakeOuterStringSerializeWithHttpInfo(body).getData(); @@ -252,6 +298,11 @@ public class FakeApi { * @param body Input string as post body (optional) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Output string -
*/ public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { Object localVarPostBody = body; @@ -287,6 +338,11 @@ public class FakeApi { * For this test, the body for this request much reference a schema named `File`. * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithFileSchema(FileSchemaTestClass body) throws ApiException { @@ -297,7 +353,13 @@ public class FakeApi { * * For this test, the body for this request much reference a schema named `File`. * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithFileSchemaWithHttpInfo(FileSchemaTestClass body) throws ApiException { Object localVarPostBody = body; @@ -339,6 +401,11 @@ public class FakeApi { * @param query (required) * @param body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public void testBodyWithQueryParams(String query, User body) throws ApiException { @@ -350,7 +417,13 @@ public class FakeApi { * * @param query (required) * @param body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 Success -
*/ public ApiResponse testBodyWithQueryParamsWithHttpInfo(String query, User body) throws ApiException { Object localVarPostBody = body; @@ -398,6 +471,11 @@ public class FakeApi { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClientModel(Client body) throws ApiException { return testClientModelWithHttpInfo(body).getData(); @@ -409,6 +487,11 @@ public class FakeApi { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClientModelWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; @@ -462,6 +545,12 @@ public class FakeApi { * @param password None (optional) * @param paramCallback None (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -485,7 +574,14 @@ public class FakeApi { * @param dateTime None (optional) * @param password None (optional) * @param paramCallback None (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { Object localVarPostBody = new Object(); @@ -576,6 +672,12 @@ if (paramCallback != null) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public void testEnumParameters(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { @@ -593,7 +695,14 @@ if (paramCallback != null) * @param enumQueryDouble Query parameter enum test (double) (optional) * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid request -
404 Not found -
*/ public ApiResponse testEnumParametersWithHttpInfo(List enumHeaderStringArray, String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger, Double enumQueryDouble, List enumFormStringArray, String enumFormString) throws ApiException { Object localVarPostBody = new Object(); @@ -646,6 +755,11 @@ if (enumFormString != null) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public void testGroupParameters(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { @@ -661,7 +775,13 @@ if (enumFormString != null) * @param stringGroup String in group parameters (optional) * @param booleanGroup Boolean in group parameters (optional) * @param int64Group Integer in group parameters (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
400 Someting wrong -
*/ public ApiResponse testGroupParametersWithHttpInfo(Integer requiredStringGroup, Boolean requiredBooleanGroup, Long requiredInt64Group, Integer stringGroup, Boolean booleanGroup, Long int64Group) throws ApiException { Object localVarPostBody = new Object(); @@ -720,6 +840,11 @@ if (booleanGroup != null) * * @param param request body (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testInlineAdditionalProperties(Map param) throws ApiException { @@ -730,7 +855,13 @@ if (booleanGroup != null) * test inline additionalProperties * * @param param request body (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testInlineAdditionalPropertiesWithHttpInfo(Map param) throws ApiException { Object localVarPostBody = param; @@ -772,6 +903,11 @@ if (booleanGroup != null) * @param param field1 (required) * @param param2 field2 (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public void testJsonFormData(String param, String param2) throws ApiException { @@ -783,7 +919,13 @@ if (booleanGroup != null) * * @param param field1 (required) * @param param2 field2 (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testJsonFormDataWithHttpInfo(String param, String param2) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 0bb82d50ca0..1d2ba11a21d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -41,6 +41,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return Client * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Client testClassname(Client body) throws ApiException { return testClassnameWithHttpInfo(body).getData(); @@ -52,6 +57,11 @@ public class FakeClassnameTags123Api { * @param body client model (required) * @return ApiResponse<Client> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse testClassnameWithHttpInfo(Client body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java index dad8fa34339..22a80aefe3a 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java @@ -42,6 +42,12 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public void addPet(Pet body) throws ApiException { @@ -52,7 +58,14 @@ public class PetApi { * Add a new pet to the store * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
405 Invalid input -
*/ public ApiResponse addPetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -94,6 +107,12 @@ public class PetApi { * @param petId Pet id to delete (required) * @param apiKey (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public void deletePet(Long petId, String apiKey) throws ApiException { @@ -105,7 +124,14 @@ public class PetApi { * * @param petId Pet id to delete (required) * @param apiKey (optional) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid pet value -
*/ public ApiResponse deletePetWithHttpInfo(Long petId, String apiKey) throws ApiException { Object localVarPostBody = new Object(); @@ -150,6 +176,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public List findPetsByStatus(List status) throws ApiException { return findPetsByStatusWithHttpInfo(status).getData(); @@ -161,6 +193,12 @@ public class PetApi { * @param status Status values that need to be considered for filter (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid status value -
*/ public ApiResponse> findPetsByStatusWithHttpInfo(List status) throws ApiException { Object localVarPostBody = new Object(); @@ -203,6 +241,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return List<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -216,6 +260,12 @@ public class PetApi { * @param tags Tags to filter by (required) * @return ApiResponse<List<Pet>> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid tag value -
* @deprecated */ @Deprecated @@ -260,6 +310,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return Pet * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public Pet getPetById(Long petId) throws ApiException { return getPetByIdWithHttpInfo(petId).getData(); @@ -271,6 +328,13 @@ public class PetApi { * @param petId ID of pet to return (required) * @return ApiResponse<Pet> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
*/ public ApiResponse getPetByIdWithHttpInfo(Long petId) throws ApiException { Object localVarPostBody = new Object(); @@ -312,6 +376,14 @@ public class PetApi { * * @param body Pet object that needs to be added to the store (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public void updatePet(Pet body) throws ApiException { @@ -322,7 +394,16 @@ public class PetApi { * Update an existing pet * * @param body Pet object that needs to be added to the store (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Pet not found -
405 Validation exception -
*/ public ApiResponse updatePetWithHttpInfo(Pet body) throws ApiException { Object localVarPostBody = body; @@ -365,6 +446,11 @@ public class PetApi { * @param name Updated name of the pet (optional) * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -377,7 +463,13 @@ public class PetApi { * @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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
405 Invalid input -
*/ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { Object localVarPostBody = new Object(); @@ -426,6 +518,11 @@ if (status != null) * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFile(Long petId, String additionalMetadata, File file) throws ApiException { return uploadFileWithHttpInfo(petId, additionalMetadata, file).getData(); @@ -439,6 +536,11 @@ if (status != null) * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithHttpInfo(Long petId, String additionalMetadata, File file) throws ApiException { Object localVarPostBody = new Object(); @@ -487,6 +589,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ModelApiResponse uploadFileWithRequiredFile(Long petId, File requiredFile, String additionalMetadata) throws ApiException { return uploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata).getData(); @@ -500,6 +607,11 @@ if (file != null) * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse uploadFileWithRequiredFileWithHttpInfo(Long petId, File requiredFile, String additionalMetadata) throws ApiException { Object localVarPostBody = new Object(); diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java index 91aaa01157d..84c59b439eb 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/StoreApi.java @@ -40,6 +40,12 @@ public class StoreApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public void deleteOrder(String orderId) throws ApiException { @@ -50,7 +56,14 @@ public class StoreApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse deleteOrderWithHttpInfo(String orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -92,6 +105,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return Map<String, Integer> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public Map getInventory() throws ApiException { return getInventoryWithHttpInfo().getData(); @@ -102,6 +120,11 @@ public class StoreApi { * Returns a map of status codes to quantities * @return ApiResponse<Map<String, Integer>> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
200 successful operation -
*/ public ApiResponse> getInventoryWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -138,6 +161,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public Order getOrderById(Long orderId) throws ApiException { return getOrderByIdWithHttpInfo(orderId).getData(); @@ -149,6 +179,13 @@ public class StoreApi { * @param orderId ID of pet that needs to be fetched (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid ID supplied -
404 Order not found -
*/ public ApiResponse getOrderByIdWithHttpInfo(Long orderId) throws ApiException { Object localVarPostBody = new Object(); @@ -191,6 +228,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return Order * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public Order placeOrder(Order body) throws ApiException { return placeOrderWithHttpInfo(body).getData(); @@ -202,6 +245,12 @@ public class StoreApi { * @param body order placed for purchasing the pet (required) * @return ApiResponse<Order> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid Order -
*/ public ApiResponse placeOrderWithHttpInfo(Order body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java index a91765dfdb9..1573bbde1ca 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/UserApi.java @@ -40,6 +40,11 @@ public class UserApi { * This can only be done by the logged in user. * @param body Created user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUser(User body) throws ApiException { @@ -50,7 +55,13 @@ public class UserApi { * Create user * This can only be done by the logged in user. * @param body Created user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUserWithHttpInfo(User body) throws ApiException { Object localVarPostBody = body; @@ -91,6 +102,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithArrayInput(List body) throws ApiException { @@ -101,7 +117,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithArrayInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -142,6 +164,11 @@ public class UserApi { * * @param body List of user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void createUsersWithListInput(List body) throws ApiException { @@ -152,7 +179,13 @@ public class UserApi { * Creates list of users with given input array * * @param body List of user object (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse createUsersWithListInputWithHttpInfo(List body) throws ApiException { Object localVarPostBody = body; @@ -193,6 +226,12 @@ public class UserApi { * 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 + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public void deleteUser(String username) throws ApiException { @@ -203,7 +242,14 @@ public class UserApi { * Delete user * This can only be done by the logged in user. * @param username The name that needs to be deleted (required) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse deleteUserWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -246,6 +292,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public User getUserByName(String username) throws ApiException { return getUserByNameWithHttpInfo(username).getData(); @@ -257,6 +310,13 @@ public class UserApi { * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return ApiResponse<User> * @throws ApiException if fails to make API call + * @http.response.details + + + + + +
Status Code Description Response Headers
200 successful operation -
400 Invalid username supplied -
404 User not found -
*/ public ApiResponse getUserByNameWithHttpInfo(String username) throws ApiException { Object localVarPostBody = new Object(); @@ -300,6 +360,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return String * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public String loginUser(String username, String password) throws ApiException { return loginUserWithHttpInfo(username, password).getData(); @@ -312,6 +378,12 @@ public class UserApi { * @param password The password for login in clear text (required) * @return ApiResponse<String> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
200 successful operation * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
400 Invalid username/password supplied -
*/ public ApiResponse loginUserWithHttpInfo(String username, String password) throws ApiException { Object localVarPostBody = new Object(); @@ -358,6 +430,11 @@ public class UserApi { * Logs out current logged in user session * * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public void logoutUser() throws ApiException { @@ -367,7 +444,13 @@ public class UserApi { /** * Logs out current logged in user session * + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + +
Status Code Description Response Headers
0 successful operation -
*/ public ApiResponse logoutUserWithHttpInfo() throws ApiException { Object localVarPostBody = new Object(); @@ -404,6 +487,12 @@ public class UserApi { * @param username name that need to be deleted (required) * @param body Updated user object (required) * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public void updateUser(String username, User body) throws ApiException { @@ -415,7 +504,14 @@ public class UserApi { * 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) + * @return ApiResponse<Void> * @throws ApiException if fails to make API call + * @http.response.details + + + + +
Status Code Description Response Headers
400 Invalid user supplied -
404 User not found -
*/ public ApiResponse updateUserWithHttpInfo(String username, User body) throws ApiException { Object localVarPostBody = body; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java index 03bcbcbd1fb..cb8d45860ae 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -59,7 +59,7 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -97,7 +97,7 @@ public class EnumArrays { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java index 5633f028051..a4cc808868d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumClass.java @@ -53,7 +53,7 @@ public enum EnumClass { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java index d7c41d30174..bdf61d52c93 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -60,7 +60,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -100,7 +100,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -138,7 +138,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } @@ -176,7 +176,7 @@ public class EnumTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java index c47f0375752..625b6be97dd 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java @@ -63,7 +63,7 @@ public class MapTest { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java index 3a7801b65b0..c6cee16a580 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java @@ -72,7 +72,7 @@ public class Order { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java index f83b0c95877..dacbbdfb2c9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -53,7 +53,7 @@ public enum OuterEnum { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java index f604115ce98..8a2408a296a 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java @@ -78,7 +78,7 @@ public class Pet { return b; } } - return null; + throw new IllegalArgumentException("Unexpected value '" + value + "'"); } } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 21590dd5662..229b37b48cc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -98,13 +98,13 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp3:okhttp:3.13.1' - compile 'com.squareup.okhttp3:logging-interceptor:3.13.1' + compile 'io.swagger:swagger-annotations:1.5.22' + compile 'com.squareup.okhttp3:okhttp:3.14.2' + compile 'com.squareup.okhttp3:logging-interceptor:3.14.2' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.3' compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' - compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt index 6f9c7fa962b..ea38e20bc43 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.sbt @@ -9,11 +9,11 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp3" % "okhttp" % "3.13.1", - "com.squareup.okhttp3" % "logging-interceptor" % "3.13.1", + "io.swagger" % "swagger-annotations" % "1.5.22", + "com.squareup.okhttp3" % "okhttp" % "3.14.2", + "com.squareup.okhttp3" % "logging-interceptor" % "3.14.2", "com.google.code.gson" % "gson" % "2.8.5", - "org.apache.commons" % "commons-lang3" % "3.8.1", + "org.apache.commons" % "commons-lang3" % "3.9", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md index ca29da916ac..7f906eed6d9 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md @@ -114,7 +114,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -173,7 +173,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index 0353247b020..30df3d74268 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -256,9 +256,9 @@ ${java.version} 1.8.3 1.5.21 - 3.14.0 + 3.14.2 2.8.5 - 3.8.1 + 3.9 1.3.8 1.0.0 4.12 diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index 6f451be8dfd..0206cad9df4 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -98,13 +98,13 @@ if(hasProperty('target') && target == 'android') { } dependencies { - compile 'io.swagger:swagger-annotations:1.5.21' - compile 'com.squareup.okhttp3:okhttp:3.13.1' - compile 'com.squareup.okhttp3:logging-interceptor:3.13.1' + compile 'io.swagger:swagger-annotations:1.5.22' + compile 'com.squareup.okhttp3:okhttp:3.14.2' + compile 'com.squareup.okhttp3:logging-interceptor:3.14.2' compile 'com.google.code.gson:gson:2.8.5' compile 'io.gsonfire:gson-fire:1.8.3' compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' - compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1' + compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.9' compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson/build.sbt b/samples/client/petstore/java/okhttp-gson/build.sbt index c5fea6a50ba..17e9ba0e59c 100644 --- a/samples/client/petstore/java/okhttp-gson/build.sbt +++ b/samples/client/petstore/java/okhttp-gson/build.sbt @@ -9,11 +9,11 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.21", - "com.squareup.okhttp3" % "okhttp" % "3.13.1", - "com.squareup.okhttp3" % "logging-interceptor" % "3.13.1", + "io.swagger" % "swagger-annotations" % "1.5.22", + "com.squareup.okhttp3" % "okhttp" % "3.14.2", + "com.squareup.okhttp3" % "logging-interceptor" % "3.14.2", "com.google.code.gson" % "gson" % "2.8.5", - "org.apache.commons" % "commons-lang3" % "3.8.1", + "org.apache.commons" % "commons-lang3" % "3.9", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.3" % "compile", diff --git a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md index ca29da916ac..7f906eed6d9 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md @@ -114,7 +114,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -173,7 +173,7 @@ public class Example { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 8d13db0ce55..a716cc878d7 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -249,9 +249,9 @@ ${java.version} 1.8.3 1.5.21 - 3.14.0 + 3.14.2 2.8.5 - 3.8.1 + 3.9 1.3.8 1.0.0 4.12 diff --git a/samples/client/petstore/java/rest-assured/docs/UserApi.md b/samples/client/petstore/java/rest-assured/docs/UserApi.md index 5b581cb9275..5f5a5dbd362 100644 --- a/samples/client/petstore/java/rest-assured/docs/UserApi.md +++ b/samples/client/petstore/java/rest-assured/docs/UserApi.md @@ -81,7 +81,7 @@ api.createUsersWithArrayInput() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -121,7 +121,7 @@ api.createUsersWithListInput() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/java/resteasy/docs/AnotherFakeApi.md b/samples/client/petstore/java/resteasy/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/resteasy/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/resteasy/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resteasy/docs/FakeApi.md b/samples/client/petstore/java/resteasy/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/resteasy/docs/FakeApi.md +++ b/samples/client/petstore/java/resteasy/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resteasy/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/resteasy/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/resteasy/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/resteasy/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resteasy/docs/PetApi.md b/samples/client/petstore/java/resteasy/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/resteasy/docs/PetApi.md +++ b/samples/client/petstore/java/resteasy/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resteasy/docs/StoreApi.md b/samples/client/petstore/java/resteasy/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/resteasy/docs/StoreApi.md +++ b/samples/client/petstore/java/resteasy/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/resteasy/docs/UserApi.md b/samples/client/petstore/java/resteasy/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/resteasy/docs/UserApi.md +++ b/samples/client/petstore/java/resteasy/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/AnotherFakeApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/resttemplate-withXml/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/StoreApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/StoreApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/AnotherFakeApi.md b/samples/client/petstore/java/resttemplate/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/resttemplate/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/resttemplate/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/FakeApi.md b/samples/client/petstore/java/resttemplate/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/resttemplate/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/resttemplate/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/resttemplate/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/resttemplate/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/PetApi.md b/samples/client/petstore/java/resttemplate/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/resttemplate/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/StoreApi.md b/samples/client/petstore/java/resttemplate/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/resttemplate/docs/StoreApi.md +++ b/samples/client/petstore/java/resttemplate/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/resttemplate/docs/UserApi.md b/samples/client/petstore/java/resttemplate/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/resttemplate/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/StoreApi.md b/samples/client/petstore/java/retrofit2-play24/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2-play25/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2-play25/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/StoreApi.md b/samples/client/petstore/java/retrofit2-play25/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md b/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/PetApi.md b/samples/client/petstore/java/retrofit2/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/StoreApi.md b/samples/client/petstore/java/retrofit2/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2/docs/UserApi.md b/samples/client/petstore/java/retrofit2/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/PetApi.md b/samples/client/petstore/java/retrofit2rx/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/StoreApi.md b/samples/client/petstore/java/retrofit2rx/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2rx2/docs/AnotherFakeApi.md index a81702b6468..f58ecd4216a 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md index b42dba573e4..29d71d3620d 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2rx2/docs/FakeClassnameTags123Api.md index 6e70e829bad..4f4dac58589 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md b/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md index 9c417f61ce0..088c67ee214 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/StoreApi.md b/samples/client/petstore/java/retrofit2rx2/docs/StoreApi.md index 1e91aca0818..ebefe2ffdd4 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/StoreApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md index 9ffe8a7c390..bdf473df90d 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/vertx/docs/AnotherFakeApi.md b/samples/client/petstore/java/vertx/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/vertx/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/vertx/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx/docs/FakeApi.md b/samples/client/petstore/java/vertx/docs/FakeApi.md index 78f37fcbc8b..9224b4d80d5 100644 --- a/samples/client/petstore/java/vertx/docs/FakeApi.md +++ b/samples/client/petstore/java/vertx/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -AsyncFile binary = new AsyncFile(); // AsyncFile | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + AsyncFile binary = new AsyncFile(); // AsyncFile | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/vertx/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/vertx/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/vertx/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx/docs/PetApi.md b/samples/client/petstore/java/vertx/docs/PetApi.md index 1430e4af1d9..6b8fb662c80 100644 --- a/samples/client/petstore/java/vertx/docs/PetApi.md +++ b/samples/client/petstore/java/vertx/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -AsyncFile file = new AsyncFile(); // AsyncFile | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + AsyncFile file = new AsyncFile(); // AsyncFile | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -AsyncFile requiredFile = new AsyncFile(); // AsyncFile | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + AsyncFile requiredFile = new AsyncFile(); // AsyncFile | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/vertx/docs/StoreApi.md b/samples/client/petstore/java/vertx/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/vertx/docs/StoreApi.md +++ b/samples/client/petstore/java/vertx/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/vertx/docs/UserApi.md b/samples/client/petstore/java/vertx/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/vertx/docs/UserApi.md +++ b/samples/client/petstore/java/vertx/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/java/webclient/docs/AnotherFakeApi.md b/samples/client/petstore/java/webclient/docs/AnotherFakeApi.md index 707f9eda8ca..059616ec6ba 100644 --- a/samples/client/petstore/java/webclient/docs/AnotherFakeApi.md +++ b/samples/client/petstore/java/webclient/docs/AnotherFakeApi.md @@ -20,18 +20,30 @@ To test special tags and operation ID starting with number ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.AnotherFakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.AnotherFakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -AnotherFakeApi apiInstance = new AnotherFakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.call123testSpecialTags(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); - e.printStackTrace(); + AnotherFakeApi apiInstance = new AnotherFakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.call123testSpecialTags(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -55,3 +67,8 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/webclient/docs/FakeApi.md b/samples/client/petstore/java/webclient/docs/FakeApi.md index 2ae7e52932f..9a2e4770201 100644 --- a/samples/client/petstore/java/webclient/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient/docs/FakeApi.md @@ -32,17 +32,29 @@ this route creates an XmlItem ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body -try { - apiInstance.createXmlItem(xmlItem); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#createXmlItem"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + XmlItem xmlItem = new XmlItem(); // XmlItem | XmlItem Body + try { + apiInstance.createXmlItem(xmlItem); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#createXmlItem"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -66,6 +78,11 @@ No authorization required - **Content-Type**: application/xml, application/xml; charset=utf-8, application/xml; charset=utf-16, text/xml, text/xml; charset=utf-8, text/xml; charset=utf-16 - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## fakeOuterBooleanSerialize @@ -79,18 +96,30 @@ Test serialization of outer boolean types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Boolean body = true; // Boolean | Input boolean as post body -try { - Boolean result = apiInstance.fakeOuterBooleanSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Boolean body = true; // Boolean | Input boolean as post body + try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -114,6 +143,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output boolean | - | + ## fakeOuterCompositeSerialize @@ -127,18 +161,30 @@ Test serialization of object with outer number type ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body -try { - OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body + try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -162,6 +208,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output composite | - | + ## fakeOuterNumberSerialize @@ -175,18 +226,30 @@ Test serialization of outer number types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body -try { - BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body + try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -210,6 +273,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output number | - | + ## fakeOuterStringSerialize @@ -223,18 +291,30 @@ Test serialization of outer string types ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String body = "body_example"; // String | Input string as post body -try { - String result = apiInstance.fakeOuterStringSerialize(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String body = "body_example"; // String | Input string as post body + try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -258,6 +338,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: */* +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Output string | - | + ## testBodyWithFileSchema @@ -271,17 +356,29 @@ For this test, the body for this request much reference a schema named `Fil ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | -try { - apiInstance.testBodyWithFileSchema(body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + FileSchemaTestClass body = new FileSchemaTestClass(); // FileSchemaTestClass | + try { + apiInstance.testBodyWithFileSchema(body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -305,6 +402,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testBodyWithQueryParams @@ -316,18 +418,30 @@ No authorization required ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String query = "query_example"; // String | -User body = new User(); // User | -try { - apiInstance.testBodyWithQueryParams(query, body); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String query = "query_example"; // String | + User body = new User(); // User | + try { + apiInstance.testBodyWithQueryParams(query, body); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -352,6 +466,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | Success | - | + ## testClientModel @@ -365,18 +484,30 @@ To test \"client\" model ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClientModel(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testClientModel"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClientModel(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -400,6 +531,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testEndpointParameters @@ -413,39 +549,48 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure HTTP basic authorization: http_basic_test + HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); + http_basic_test.setUsername("YOUR USERNAME"); + http_basic_test.setPassword("YOUR PASSWORD"); -// Configure HTTP basic authorization: http_basic_test -HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); -http_basic_test.setUsername("YOUR USERNAME"); -http_basic_test.setPassword("YOUR PASSWORD"); - -FakeApi apiInstance = new FakeApi(); -BigDecimal number = new BigDecimal(); // BigDecimal | None -Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None -byte[] _byte = null; // byte[] | None -Integer integer = 56; // Integer | None -Integer int32 = 56; // Integer | None -Long int64 = 56L; // Long | None -Float _float = 3.4F; // Float | None -String string = "string_example"; // String | None -File binary = new File("/path/to/file"); // File | None -LocalDate date = new LocalDate(); // LocalDate | None -OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "password_example"; // String | None -String paramCallback = "paramCallback_example"; // String | None -try { - apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEndpointParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + BigDecimal number = new BigDecimal(); // BigDecimal | None + Double _double = 3.4D; // Double | None + String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None + byte[] _byte = null; // byte[] | None + Integer integer = 56; // Integer | None + Integer int32 = 56; // Integer | None + Long int64 = 56L; // Long | None + Float _float = 3.4F; // Float | None + String string = "string_example"; // String | None + File binary = new File("/path/to/file"); // File | None + LocalDate date = new LocalDate(); // LocalDate | None + OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None + String password = "password_example"; // String | None + String paramCallback = "paramCallback_example"; // String | None + try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -482,6 +627,12 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## testEnumParameters @@ -495,24 +646,36 @@ To test enum parameters ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) -String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) -String enumQueryString = "-efg"; // String | Query parameter enum test (string) -Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) -Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) -List enumFormStringArray = "$"; // List | Form parameter enum test (string array) -String enumFormString = "-efg"; // String | Form parameter enum test (string) -try { - apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testEnumParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) + String enumHeaderString = "-efg"; // String | Header parameter enum test (string) + List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) + String enumQueryString = "-efg"; // String | Query parameter enum test (string) + Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) + Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) + List enumFormStringArray = "$"; // List | Form parameter enum test (string array) + String enumFormString = "-efg"; // String | Form parameter enum test (string) + try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -543,6 +706,12 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid request | - | +| **404** | Not found | - | + ## testGroupParameters @@ -556,22 +725,34 @@ Fake endpoint to test group parameters (optional) ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Integer requiredStringGroup = 56; // Integer | Required String in group parameters -Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters -Long requiredInt64Group = 56L; // Long | Required Integer in group parameters -Integer stringGroup = 56; // Integer | String in group parameters -Boolean booleanGroup = true; // Boolean | Boolean in group parameters -Long int64Group = 56L; // Long | Integer in group parameters -try { - apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testGroupParameters"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Integer requiredStringGroup = 56; // Integer | Required String in group parameters + Boolean requiredBooleanGroup = true; // Boolean | Required Boolean in group parameters + Long requiredInt64Group = 56L; // Long | Required Integer in group parameters + Integer stringGroup = 56; // Integer | String in group parameters + Boolean booleanGroup = true; // Boolean | Boolean in group parameters + Long int64Group = 56L; // Long | Integer in group parameters + try { + apiInstance.testGroupParameters(requiredStringGroup, requiredBooleanGroup, requiredInt64Group, stringGroup, booleanGroup, int64Group); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testGroupParameters"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -600,6 +781,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Someting wrong | - | + ## testInlineAdditionalProperties @@ -611,17 +797,29 @@ test inline additionalProperties ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -Map param = new HashMap(); // Map | request body -try { - apiInstance.testInlineAdditionalProperties(param); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + Map param = new HashMap(); // Map | request body + try { + apiInstance.testInlineAdditionalProperties(param); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -645,6 +843,11 @@ No authorization required - **Content-Type**: application/json - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## testJsonFormData @@ -656,18 +859,30 @@ test json serialization of form data ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.FakeApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -FakeApi apiInstance = new FakeApi(); -String param = "param_example"; // String | field1 -String param2 = "param2_example"; // String | field2 -try { - apiInstance.testJsonFormData(param, param2); -} catch (ApiException e) { - System.err.println("Exception when calling FakeApi#testJsonFormData"); - e.printStackTrace(); + FakeApi apiInstance = new FakeApi(defaultClient); + String param = "param_example"; // String | field1 + String param2 = "param2_example"; // String | field2 + try { + apiInstance.testJsonFormData(param, param2); + } catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -692,3 +907,8 @@ No authorization required - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/webclient/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/webclient/docs/FakeClassnameTags123Api.md index 9d22b2e3f94..14a74a37a4e 100644 --- a/samples/client/petstore/java/webclient/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/java/webclient/docs/FakeClassnameTags123Api.md @@ -20,28 +20,37 @@ To test class name in snake case ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.FakeClassnameTags123Api; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.FakeClassnameTags123Api; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key_query + ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); + api_key_query.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key_query.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key_query -ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); -api_key_query.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key_query.setApiKeyPrefix("Token"); - -FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); -Client body = new Client(); // Client | client model -try { - Client result = apiInstance.testClassname(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); - e.printStackTrace(); + FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(defaultClient); + Client body = new Client(); // Client | client model + try { + Client result = apiInstance.testClassname(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -65,3 +74,8 @@ Name | Type | Description | Notes - **Content-Type**: application/json - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/webclient/docs/PetApi.md b/samples/client/petstore/java/webclient/docs/PetApi.md index 2c71fc85134..875a8e6783e 100644 --- a/samples/client/petstore/java/webclient/docs/PetApi.md +++ b/samples/client/petstore/java/webclient/docs/PetApi.md @@ -26,25 +26,34 @@ Add a new pet to the store ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.addPet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#addPet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.addPet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -68,6 +77,12 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **405** | Invalid input | - | + ## deletePet @@ -79,26 +94,35 @@ Deletes a pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | Pet id to delete -String apiKey = "apiKey_example"; // String | -try { - apiInstance.deletePet(petId, apiKey); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#deletePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | Pet id to delete + String apiKey = "apiKey_example"; // String | + try { + apiInstance.deletePet(petId, apiKey); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -123,6 +147,12 @@ null (empty response body) - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid pet value | - | + ## findPetsByStatus @@ -136,26 +166,35 @@ Multiple status values can be provided with comma separated strings ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List status = Arrays.asList("available"); // List | Status values that need to be considered for filter -try { - List result = apiInstance.findPetsByStatus(status); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByStatus"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List status = Arrays.asList("available"); // List | Status values that need to be considered for filter + try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -179,6 +218,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid status value | - | + ## findPetsByTags @@ -192,26 +237,35 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -List tags = Arrays.asList(); // List | Tags to filter by -try { - List result = apiInstance.findPetsByTags(tags); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#findPetsByTags"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + List tags = Arrays.asList(); // List | Tags to filter by + try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -235,6 +289,12 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid tag value | - | + ## getPetById @@ -248,28 +308,37 @@ Returns a single pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to return -try { - Pet result = apiInstance.getPetById(petId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#getPetById"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to return + try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -293,6 +362,13 @@ Name | Type | Description | Notes - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | + ## updatePet @@ -304,25 +380,34 @@ Update an existing pet ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Pet body = new Pet(); // Pet | Pet object that needs to be added to the store -try { - apiInstance.updatePet(body); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePet"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Pet body = new Pet(); // Pet | Pet object that needs to be added to the store + try { + apiInstance.updatePet(body); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -346,6 +431,14 @@ null (empty response body) - **Content-Type**: application/json, application/xml - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Pet not found | - | +| **405** | Validation exception | - | + ## updatePetWithForm @@ -357,27 +450,36 @@ Updates a pet in the store with form data ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "name_example"; // String | Updated name of the pet -String status = "status_example"; // String | Updated status of the pet -try { - apiInstance.updatePetWithForm(petId, name, status); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#updatePetWithForm"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet that needs to be updated + String name = "name_example"; // String | Updated name of the pet + String status = "status_example"; // String | Updated status of the pet + try { + apiInstance.updatePetWithForm(petId, name, status); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -403,6 +505,11 @@ null (empty response body) - **Content-Type**: application/x-www-form-urlencoded - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **405** | Invalid input | - | + ## uploadFile @@ -414,28 +521,37 @@ uploads an image ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -File file = new File("/path/to/file"); // File | file to upload -try { - ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + File file = new File("/path/to/file"); // File | file to upload + try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -461,6 +577,11 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## uploadFileWithRequiredFile @@ -472,28 +593,37 @@ uploads an image (required) ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.PetApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.PetApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure OAuth2 access token for authorization: petstore_auth + OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); + petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); -// Configure OAuth2 access token for authorization: petstore_auth -OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); -petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); - -PetApi apiInstance = new PetApi(); -Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("/path/to/file"); // File | file to upload -String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server -try { - ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); - e.printStackTrace(); + PetApi apiInstance = new PetApi(defaultClient); + Long petId = 56L; // Long | ID of pet to update + File requiredFile = new File("/path/to/file"); // File | file to upload + String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server + try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -519,3 +649,8 @@ Name | Type | Description | Notes - **Content-Type**: multipart/form-data - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + diff --git a/samples/client/petstore/java/webclient/docs/StoreApi.md b/samples/client/petstore/java/webclient/docs/StoreApi.md index 65f7651545c..352399ea515 100644 --- a/samples/client/petstore/java/webclient/docs/StoreApi.md +++ b/samples/client/petstore/java/webclient/docs/StoreApi.md @@ -23,17 +23,29 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -String orderId = "orderId_example"; // String | ID of the order that needs to be deleted -try { - apiInstance.deleteOrder(orderId); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#deleteOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + String orderId = "orderId_example"; // String | ID of the order that needs to be deleted + try { + apiInstance.deleteOrder(orderId); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -57,6 +69,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## getInventory @@ -70,27 +88,36 @@ Returns a map of status codes to quantities ```java // Import classes: -//import org.openapitools.client.ApiClient; -//import org.openapitools.client.ApiException; -//import org.openapitools.client.Configuration; -//import org.openapitools.client.auth.*; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.auth.*; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; -ApiClient defaultClient = Configuration.getDefaultApiClient(); +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); + + // Configure API key authorization: api_key + ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); + api_key.setApiKey("YOUR API KEY"); + // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) + //api_key.setApiKeyPrefix("Token"); -// Configure API key authorization: api_key -ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); -api_key.setApiKey("YOUR API KEY"); -// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) -//api_key.setApiKeyPrefix("Token"); - -StoreApi apiInstance = new StoreApi(); -try { - Map result = apiInstance.getInventory(); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getInventory"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + try { + Map result = apiInstance.getInventory(); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -111,6 +138,11 @@ This endpoint does not need any parameter. - **Content-Type**: Not defined - **Accept**: application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | + ## getOrderById @@ -124,18 +156,30 @@ For valid response try integer IDs with value <= 5 or > 10. Other val ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Long orderId = 56L; // Long | ID of pet that needs to be fetched -try { - Order result = apiInstance.getOrderById(orderId); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#getOrderById"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Long orderId = 56L; // Long | ID of pet that needs to be fetched + try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -159,6 +203,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid ID supplied | - | +| **404** | Order not found | - | + ## placeOrder @@ -170,18 +221,30 @@ Place an order for a pet ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.StoreApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.StoreApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -StoreApi apiInstance = new StoreApi(); -Order body = new Order(); // Order | order placed for purchasing the pet -try { - Order result = apiInstance.placeOrder(body); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling StoreApi#placeOrder"); - e.printStackTrace(); + StoreApi apiInstance = new StoreApi(defaultClient); + Order body = new Order(); // Order | order placed for purchasing the pet + try { + Order result = apiInstance.placeOrder(body); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -205,3 +268,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid Order | - | + diff --git a/samples/client/petstore/java/webclient/docs/UserApi.md b/samples/client/petstore/java/webclient/docs/UserApi.md index 9133d79c33c..4154aba4f17 100644 --- a/samples/client/petstore/java/webclient/docs/UserApi.md +++ b/samples/client/petstore/java/webclient/docs/UserApi.md @@ -27,17 +27,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -User body = new User(); // User | Created user object -try { - apiInstance.createUser(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + User body = new User(); // User | Created user object + try { + apiInstance.createUser(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -61,6 +73,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithArrayInput @@ -72,17 +89,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithArrayInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithArrayInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -91,7 +120,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -106,6 +135,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## createUsersWithListInput @@ -117,17 +151,29 @@ Creates list of users with given input array ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -List body = Arrays.asList(null); // List | List of user object -try { - apiInstance.createUsersWithListInput(body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#createUsersWithListInput"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + List body = Arrays.asList(null); // List | List of user object + try { + apiInstance.createUsersWithListInput(body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -136,7 +182,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](List.md)| List of user object | + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -151,6 +197,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## deleteUser @@ -164,17 +215,29 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be deleted -try { - apiInstance.deleteUser(username); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#deleteUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be deleted + try { + apiInstance.deleteUser(username); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -198,6 +261,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## getUserByName @@ -209,18 +278,30 @@ Get user by user name ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. -try { - User result = apiInstance.getUserByName(username); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#getUserByName"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. + try { + User result = apiInstance.getUserByName(username); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -244,6 +325,13 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | - | +| **400** | Invalid username supplied | - | +| **404** | User not found | - | + ## loginUser @@ -255,19 +343,31 @@ Logs user into the system ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | The user name for login -String password = "password_example"; // String | The password for login in clear text -try { - String result = apiInstance.loginUser(username, password); - System.out.println(result); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#loginUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | The user name for login + String password = "password_example"; // String | The password for login in clear text + try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -292,6 +392,12 @@ No authorization required - **Content-Type**: Not defined - **Accept**: application/xml, application/json +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **200** | successful operation | * X-Rate-Limit - calls per hour allowed by the user
* X-Expires-After - date in UTC when token expires
| +| **400** | Invalid username/password supplied | - | + ## logoutUser @@ -303,16 +409,28 @@ Logs out current logged in user session ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -try { - apiInstance.logoutUser(); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#logoutUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + try { + apiInstance.logoutUser(); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -333,6 +451,11 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **0** | successful operation | - | + ## updateUser @@ -346,18 +469,30 @@ This can only be done by the logged in user. ```java // Import classes: -//import org.openapitools.client.ApiException; -//import org.openapitools.client.api.UserApi; +import org.openapitools.client.ApiClient; +import org.openapitools.client.ApiException; +import org.openapitools.client.Configuration; +import org.openapitools.client.models.*; +import org.openapitools.client.api.UserApi; +public class Example { + public static void main(String[] args) { + ApiClient defaultClient = Configuration.getDefaultApiClient(); + defaultClient.setBasePath("http://petstore.swagger.io:80/v2"); -UserApi apiInstance = new UserApi(); -String username = "username_example"; // String | name that need to be deleted -User body = new User(); // User | Updated user object -try { - apiInstance.updateUser(username, body); -} catch (ApiException e) { - System.err.println("Exception when calling UserApi#updateUser"); - e.printStackTrace(); + UserApi apiInstance = new UserApi(defaultClient); + String username = "username_example"; // String | name that need to be deleted + User body = new User(); // User | Updated user object + try { + apiInstance.updateUser(username, body); + } catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + System.err.println("Status code: " + e.getCode()); + System.err.println("Reason: " + e.getResponseBody()); + System.err.println("Response headers: " + e.getResponseHeaders()); + e.printStackTrace(); + } + } } ``` @@ -382,3 +517,9 @@ No authorization required - **Content-Type**: Not defined - **Accept**: Not defined +### HTTP response details +| Status code | Description | Response headers | +|-------------|-------------|------------------| +| **400** | Invalid user supplied | - | +| **404** | User not found | - | + diff --git a/samples/client/petstore/javascript-es6/docs/UserApi.md b/samples/client/petstore/javascript-es6/docs/UserApi.md index 11b1a96e510..121ddbda665 100644 --- a/samples/client/petstore/javascript-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-es6/docs/UserApi.md @@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body, (error, data, response) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body, (error, data, response) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-es6/src/api/UserApi.js b/samples/client/petstore/javascript-es6/src/api/UserApi.js index 9c6c64ff776..aba7b237e69 100644 --- a/samples/client/petstore/javascript-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-es6/src/api/UserApi.js @@ -85,7 +85,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response */ createUsersWithArrayInput(body, callback) { @@ -125,7 +125,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response */ createUsersWithListInput(body, callback) { diff --git a/samples/client/petstore/javascript-flowtyped/.babelrc b/samples/client/petstore/javascript-flowtyped/.babelrc index 75148dc5edb..4bf17b5e66e 100644 --- a/samples/client/petstore/javascript-flowtyped/.babelrc +++ b/samples/client/petstore/javascript-flowtyped/.babelrc @@ -1,4 +1,9 @@ { - "presets": ["react-app"], - "plugins": ["transform-flow-strip-types"] + "presets": [ + "react-app", + "@babel/preset-flow" + ], + "plugins": [ + "@babel/plugin-transform-flow-strip-types" + ] } diff --git a/samples/client/petstore/javascript-flowtyped/.openapi-generator/VERSION b/samples/client/petstore/javascript-flowtyped/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/client/petstore/javascript-flowtyped/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-flowtyped/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-flowtyped/README.md b/samples/client/petstore/javascript-flowtyped/README.md index f9b11cbd029..9c2bec57335 100644 --- a/samples/client/petstore/javascript-flowtyped/README.md +++ b/samples/client/petstore/javascript-flowtyped/README.md @@ -18,7 +18,8 @@ Module system To build an compile the flow typed sources to javascript use: ``` npm install -npm run build +# The dependency `babel-preset-react-app` requires that you specify `NODE_ENV` or `BABEL_ENV` environment variables +env BABEL_ENV={YOUR_ENV} npm run build ``` ### Publishing diff --git a/samples/client/petstore/javascript-flowtyped/lib/api.js b/samples/client/petstore/javascript-flowtyped/lib/api.js index 0dec200768e..e0ed087f022 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/api.js +++ b/samples/client/petstore/javascript-flowtyped/lib/api.js @@ -1,427 +1,391 @@ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } - -function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } +import _classCallCheck from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/classCallCheck"; +import _possibleConstructorReturn from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn"; +import _getPrototypeOf from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/getPrototypeOf"; +import _inherits from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/inherits"; +import _wrapNativeSuper from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/wrapNativeSuper"; /* eslint-disable no-use-before-define */ + /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech * Do not edit the class manually. */ - import * as url from "url"; import * as portableFetch from "portable-fetch"; import { Configuration } from "./configuration"; - var BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); - /** * * @export */ + export var COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|" + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|" }; - /** * * @export */ - -/** - * - * @export - */ - - -/** - * - * @export - */ - - /** * * @export * @class RequiredError * @extends {Error} */ -export var RequiredError = function (_Error) { - _inherits(RequiredError, _Error); +export var RequiredError = +/*#__PURE__*/ +function (_Error) { + _inherits(RequiredError, _Error); - function RequiredError(field, msg) { - _classCallCheck(this, RequiredError); + function RequiredError(field, msg) { + var _this; - var _this = _possibleConstructorReturn(this, (RequiredError.__proto__ || Object.getPrototypeOf(RequiredError)).call(this, msg)); + _classCallCheck(this, RequiredError); - _this.name = "RequiredError"; - return _this; - } - - return RequiredError; -}(Error); + _this = _possibleConstructorReturn(this, _getPrototypeOf(RequiredError).call(this, msg)); + _this.name = "RequiredError"; + return _this; + } + return RequiredError; +}(_wrapNativeSuper(Error)); /** * Describes the result of uploading an image resource * @export */ - -/** - * A category for a pet - * @export - */ - -/** - * An order for a pets from the pet store - * @export - */ - -/** - * A pet for sale in the pet store - * @export - */ - - -/** - * A tag for a pet - * @export - */ - - -/** - * A User who is purchasing from the pet store - * @export - */ - - /** * PetApi - fetch parameter creator * @export */ export var PetApiFetchParamCreator = function PetApiFetchParamCreator(configuration) { - return { - /** - * - * @summary Add a new pet to the store - * @throws {RequiredError} - */ - addPet: function addPet(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling addPet.'); - } - var localVarPath = "/pet"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + return { + /** + * + * @summary Add a new pet to the store + * @throws {RequiredError} + */ + addPet: function addPet(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling addPet.'); + } - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + var localVarPath = "/pet"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication petstore_auth required + // oauth required - localVarHeaderParameter['Content-Type'] = 'application/json'; + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * - * @summary Deletes a pet - * @throws {RequiredError} - */ - deletePet: function deletePet(petId, apiKey, options) { - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling deletePet.'); - } - var localVarPath = "/pet/{petId}".replace("{" + "petId" + "}", encodeURIComponent(String(petId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'DELETE' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * + * @summary Deletes a pet + * @throws {RequiredError} + */ + deletePet: function deletePet(petId, apiKey, options) { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling deletePet.'); + } - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + var localVarPath = "/pet/{petId}".replace("{".concat("petId", "}"), encodeURIComponent(String(petId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'DELETE' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication petstore_auth required + // oauth required - if (apiKey !== undefined && apiKey !== null) { - localVarHeaderParameter['api_key'] = apiKey; - } + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = apiKey; + } - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - /** - * Multiple status values can be provided with comma separated strings - * @summary Finds Pets by status - * @throws {RequiredError} - */ - findPetsByStatus: function findPetsByStatus(status, options) { - // verify required parameter 'status' is not null or undefined - if (status === null || status === undefined) { - throw new RequiredError('status', 'Required parameter status was null or undefined when calling findPetsByStatus.'); - } - var localVarPath = "/pet/findByStatus"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @throws {RequiredError} + */ + findPetsByStatus: function findPetsByStatus(status, options) { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status', 'Required parameter status was null or undefined when calling findPetsByStatus.'); + } - if (status) { - localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); - } + var localVarPath = "/pet/findByStatus"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication petstore_auth required + // oauth required - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } - /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @summary Finds Pets by tags - * @throws {RequiredError} - */ - findPetsByTags: function findPetsByTags(tags, options) { - // verify required parameter 'tags' is not null or undefined - if (tags === null || tags === undefined) { - throw new RequiredError('tags', 'Required parameter tags was null or undefined when calling findPetsByTags.'); - } - var localVarPath = "/pet/findByTags"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - if (tags) { - localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); - } + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @throws {RequiredError} + */ + findPetsByTags: function findPetsByTags(tags, options) { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags', 'Required parameter tags was null or undefined when calling findPetsByTags.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var localVarPath = "/pet/findByTags"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication petstore_auth required + // oauth required - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - /** - * Returns a single pet - * @summary Find pet by ID - * @throws {RequiredError} - */ - getPetById: function getPetById(petId, options) { - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling getPetById.'); - } - var localVarPath = "/pet/{petId}".replace("{" + "petId" + "}", encodeURIComponent(String(petId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } - // authentication api_key required - if (configuration && configuration.apiKey) { - var localVarApiKeyValue = typeof configuration.apiKey === 'function' ? configuration.apiKey("api_key") : configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + /** + * Returns a single pet + * @summary Find pet by ID + * @throws {RequiredError} + */ + getPetById: function getPetById(petId, options) { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling getPetById.'); + } - /** - * - * @summary Update an existing pet - * @throws {RequiredError} - */ - updatePet: function updatePet(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling updatePet.'); - } - var localVarPath = "/pet"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'PUT' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + var localVarPath = "/pet/{petId}".replace("{".concat("petId", "}"), encodeURIComponent(String(petId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication api_key required - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + if (configuration && configuration.apiKey) { + var localVarApiKeyValue = typeof configuration.apiKey === 'function' ? configuration.apiKey("api_key") : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } - localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + /** + * + * @summary Update an existing pet + * @throws {RequiredError} + */ + updatePet: function updatePet(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling updatePet.'); + } - /** - * - * @summary Updates a pet in the store with form data - * @throws {RequiredError} - */ - updatePetWithForm: function updatePetWithForm(petId, name, status, options) { - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling updatePetWithForm.'); - } - var localVarPath = "/pet/{petId}".replace("{" + "petId" + "}", encodeURIComponent(String(petId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; - var localVarFormParams = new FormData(); + var localVarPath = "/pet"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'PUT' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication petstore_auth required + // oauth required - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - if (name !== undefined) { - localVarFormParams.set('name', name); - } + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - if (status !== undefined) { - localVarFormParams.set('status', status); - } + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams; + /** + * + * @summary Updates a pet in the store with form data + * @throws {RequiredError} + */ + updatePetWithForm: function updatePetWithForm(petId, name, status, options) { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling updatePetWithForm.'); + } - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + var localVarPath = "/pet/{petId}".replace("{".concat("petId", "}"), encodeURIComponent(String(petId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + var localVarFormParams = new FormData(); // authentication petstore_auth required + // oauth required - /** - * - * @summary uploads an image - * @throws {RequiredError} - */ - uploadFile: function uploadFile(petId, additionalMetadata, file, options) { - // verify required parameter 'petId' is not null or undefined - if (petId === null || petId === undefined) { - throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling uploadFile.'); - } - var localVarPath = "/pet/{petId}/uploadImage".replace("{" + "petId" + "}", encodeURIComponent(String(petId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; - var localVarFormParams = new FormData(); + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } - // authentication petstore_auth required - // oauth required - if (configuration && configuration.accessToken) { - var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; - localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; - } + if (name !== undefined) { + localVarFormParams.set('name', name); + } - if (additionalMetadata !== undefined) { - localVarFormParams.set('additionalMetadata', additionalMetadata); - } + if (status !== undefined) { + localVarFormParams.set('status', status); + } - if (file !== undefined) { - localVarFormParams.set('file', file); - } + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - localVarRequestOptions.body = localVarFormParams; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.body = localVarFormParams; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - } - }; + /** + * + * @summary uploads an image + * @throws {RequiredError} + */ + uploadFile: function uploadFile(petId, additionalMetadata, file, options) { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId', 'Required parameter petId was null or undefined when calling uploadFile.'); + } + + var localVarPath = "/pet/{petId}/uploadImage".replace("{".concat("petId", "}"), encodeURIComponent(String(petId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + var localVarFormParams = new FormData(); // authentication petstore_auth required + // oauth required + + if (configuration && configuration.accessToken) { + var localVarAccessTokenValue = typeof configuration.accessToken === 'function' ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata); + } + + if (file !== undefined) { + localVarFormParams.set('file', file); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.body = localVarFormParams; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + } + }; }; /** @@ -429,276 +393,269 @@ export var PetApiFetchParamCreator = function PetApiFetchParamCreator(configurat * @export */ export var PetApi = function PetApi(configuration) { - var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; - - var basePath = configuration && configuration.basePath || BASE_PATH; - return { - /** - * - * @summary Add a new pet to the store - * @throws {RequiredError} - */ - addPet: function addPet(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).addPet(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary Deletes a pet - * @throws {RequiredError} - */ - deletePet: function deletePet(petId, apiKey) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).deletePet(petId, apiKey, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * Multiple status values can be provided with comma separated strings - * @summary Finds Pets by status - * @throws {RequiredError} - */ - findPetsByStatus: function findPetsByStatus(status) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * @summary Finds Pets by tags - * @throws {RequiredError} - */ - findPetsByTags: function findPetsByTags(tags) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByTags(tags, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * Returns a single pet - * @summary Find pet by ID - * @throws {RequiredError} - */ - getPetById: function getPetById(petId) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).getPetById(petId, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * - * @summary Update an existing pet - * @throws {RequiredError} - */ - updatePet: function updatePet(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePet(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary Updates a pet in the store with form data - * @throws {RequiredError} - */ - updatePetWithForm: function updatePetWithForm(petId, name, status) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePetWithForm(petId, name, status, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary uploads an image - * @throws {RequiredError} - */ - uploadFile: function uploadFile(petId, additionalMetadata, file) { - var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; - - var localVarFetchArgs = PetApiFetchParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); + var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; + var basePath = configuration && configuration.basePath || BASE_PATH; + return { + /** + * + * @summary Add a new pet to the store + * @throws {RequiredError} + */ + addPet: function addPet(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).addPet(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; } - }; -}; + }); + }, + /** + * + * @summary Deletes a pet + * @throws {RequiredError} + */ + deletePet: function deletePet(petId, apiKey) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).deletePet(petId, apiKey, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @throws {RequiredError} + */ + findPetsByStatus: function findPetsByStatus(status) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByStatus(status, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @throws {RequiredError} + */ + findPetsByTags: function findPetsByTags(tags) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).findPetsByTags(tags, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * Returns a single pet + * @summary Find pet by ID + * @throws {RequiredError} + */ + getPetById: function getPetById(petId) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).getPetById(petId, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * + * @summary Update an existing pet + * @throws {RequiredError} + */ + updatePet: function updatePet(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePet(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * + * @summary Updates a pet in the store with form data + * @throws {RequiredError} + */ + updatePetWithForm: function updatePetWithForm(petId, name, status) { + var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * + * @summary uploads an image + * @throws {RequiredError} + */ + uploadFile: function uploadFile(petId, additionalMetadata, file) { + var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var localVarFetchArgs = PetApiFetchParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + } + }; +}; /** * StoreApi - fetch parameter creator * @export */ + export var StoreApiFetchParamCreator = function StoreApiFetchParamCreator(configuration) { - return { - /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @summary Delete purchase order by ID - * @throws {RequiredError} - */ - deleteOrder: function deleteOrder(orderId, options) { - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId', 'Required parameter orderId was null or undefined when calling deleteOrder.'); - } - var localVarPath = "/store/order/{orderId}".replace("{" + "orderId" + "}", encodeURIComponent(String(orderId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'DELETE' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @throws {RequiredError} + */ + deleteOrder: function deleteOrder(orderId, options) { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId', 'Required parameter orderId was null or undefined when calling deleteOrder.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var localVarPath = "/store/order/{orderId}".replace("{".concat("orderId", "}"), encodeURIComponent(String(orderId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'DELETE' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - * @throws {RequiredError} - */ - getInventory: function getInventory(options) { - var localVarPath = "/store/inventory"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @throws {RequiredError} + */ + getInventory: function getInventory(options) { + var localVarPath = "/store/inventory"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; // authentication api_key required - // authentication api_key required - if (configuration && configuration.apiKey) { - var localVarApiKeyValue = typeof configuration.apiKey === 'function' ? configuration.apiKey("api_key") : configuration.apiKey; - localVarHeaderParameter["api_key"] = localVarApiKeyValue; - } + if (configuration && configuration.apiKey) { + var localVarApiKeyValue = typeof configuration.apiKey === 'function' ? configuration.apiKey("api_key") : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @summary Find purchase order by ID - * @throws {RequiredError} - */ - getOrderById: function getOrderById(orderId, options) { - // verify required parameter 'orderId' is not null or undefined - if (orderId === null || orderId === undefined) { - throw new RequiredError('orderId', 'Required parameter orderId was null or undefined when calling getOrderById.'); - } - var localVarPath = "/store/order/{orderId}".replace("{" + "orderId" + "}", encodeURIComponent(String(orderId))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @throws {RequiredError} + */ + getOrderById: function getOrderById(orderId, options) { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId', 'Required parameter orderId was null or undefined when calling getOrderById.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var localVarPath = "/store/order/{orderId}".replace("{".concat("orderId", "}"), encodeURIComponent(String(orderId))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * - * @summary Place an order for a pet - * @throws {RequiredError} - */ - placeOrder: function placeOrder(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling placeOrder.'); - } - var localVarPath = "/store/order"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * + * @summary Place an order for a pet + * @throws {RequiredError} + */ + placeOrder: function placeOrder(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling placeOrder.'); + } - localVarHeaderParameter['Content-Type'] = 'application/json'; + var localVarPath = "/store/order"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; - - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - } - }; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + } + }; }; /** @@ -706,334 +663,335 @@ export var StoreApiFetchParamCreator = function StoreApiFetchParamCreator(config * @export */ export var StoreApi = function StoreApi(configuration) { - var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; - - var basePath = configuration && configuration.basePath || BASE_PATH; - return { - /** - * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * @summary Delete purchase order by ID - * @throws {RequiredError} - */ - deleteOrder: function deleteOrder(orderId) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = StoreApiFetchParamCreator(configuration).deleteOrder(orderId, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * Returns a map of status codes to quantities - * @summary Returns pet inventories by status - * @throws {RequiredError} - */ - getInventory: function getInventory() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var localVarFetchArgs = StoreApiFetchParamCreator(configuration).getInventory(options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * @summary Find purchase order by ID - * @throws {RequiredError} - */ - getOrderById: function getOrderById(orderId) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = StoreApiFetchParamCreator(configuration).getOrderById(orderId, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * - * @summary Place an order for a pet - * @throws {RequiredError} - */ - placeOrder: function placeOrder(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = StoreApiFetchParamCreator(configuration).placeOrder(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); + var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; + var basePath = configuration && configuration.basePath || BASE_PATH; + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @throws {RequiredError} + */ + deleteOrder: function deleteOrder(orderId) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = StoreApiFetchParamCreator(configuration).deleteOrder(orderId, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; } - }; -}; + }); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @throws {RequiredError} + */ + getInventory: function getInventory() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var localVarFetchArgs = StoreApiFetchParamCreator(configuration).getInventory(options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @throws {RequiredError} + */ + getOrderById: function getOrderById(orderId) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = StoreApiFetchParamCreator(configuration).getOrderById(orderId, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * + * @summary Place an order for a pet + * @throws {RequiredError} + */ + placeOrder: function placeOrder(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = StoreApiFetchParamCreator(configuration).placeOrder(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + } + }; +}; /** * UserApi - fetch parameter creator * @export */ + export var UserApiFetchParamCreator = function UserApiFetchParamCreator(configuration) { - return { - /** - * This can only be done by the logged in user. - * @summary Create user - * @throws {RequiredError} - */ - createUser: function createUser(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUser.'); - } - var localVarPath = "/user"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @throws {RequiredError} + */ + createUser: function createUser(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUser.'); + } - localVarHeaderParameter['Content-Type'] = 'application/json'; + var localVarPath = "/user"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + /** + * + * @summary Creates list of users with given input array + * @throws {RequiredError} + */ + createUsersWithArrayInput: function createUsersWithArrayInput(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUsersWithArrayInput.'); + } - /** - * - * @summary Creates list of users with given input array - * @throws {RequiredError} - */ - createUsersWithArrayInput: function createUsersWithArrayInput(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUsersWithArrayInput.'); - } - var localVarPath = "/user/createWithArray"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + var localVarPath = "/user/createWithArray"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarHeaderParameter['Content-Type'] = 'application/json'; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + /** + * + * @summary Creates list of users with given input array + * @throws {RequiredError} + */ + createUsersWithListInput: function createUsersWithListInput(body, options) { + // verify required parameter 'body' is not null or undefined + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUsersWithListInput.'); + } - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + var localVarPath = "/user/createWithList"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'POST' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - /** - * - * @summary Creates list of users with given input array - * @throws {RequiredError} - */ - createUsersWithListInput: function createUsersWithListInput(body, options) { - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling createUsersWithListInput.'); - } - var localVarPath = "/user/createWithList"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'POST' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - localVarHeaderParameter['Content-Type'] = 'application/json'; + /** + * This can only be done by the logged in user. + * @summary Delete user + * @throws {RequiredError} + */ + deleteUser: function deleteUser(username, options) { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username', 'Required parameter username was null or undefined when calling deleteUser.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + var localVarPath = "/user/{username}".replace("{".concat("username", "}"), encodeURIComponent(String(username))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'DELETE' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * This can only be done by the logged in user. - * @summary Delete user - * @throws {RequiredError} - */ - deleteUser: function deleteUser(username, options) { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling deleteUser.'); - } - var localVarPath = "/user/{username}".replace("{" + "username" + "}", encodeURIComponent(String(username))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'DELETE' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * + * @summary Get user by user name + * @throws {RequiredError} + */ + getUserByName: function getUserByName(username, options) { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username', 'Required parameter username was null or undefined when calling getUserByName.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var localVarPath = "/user/{username}".replace("{".concat("username", "}"), encodeURIComponent(String(username))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * - * @summary Get user by user name - * @throws {RequiredError} - */ - getUserByName: function getUserByName(username, options) { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling getUserByName.'); - } - var localVarPath = "/user/{username}".replace("{" + "username" + "}", encodeURIComponent(String(username))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * + * @summary Logs user into the system + * @throws {RequiredError} + */ + loginUser: function loginUser(username, password, options) { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username', 'Required parameter username was null or undefined when calling loginUser.'); + } // verify required parameter 'password' is not null or undefined - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + if (password === null || password === undefined) { + throw new RequiredError('password', 'Required parameter password was null or undefined when calling loginUser.'); + } - /** - * - * @summary Logs user into the system - * @throws {RequiredError} - */ - loginUser: function loginUser(username, password, options) { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling loginUser.'); - } - // verify required parameter 'password' is not null or undefined - if (password === null || password === undefined) { - throw new RequiredError('password', 'Required parameter password was null or undefined when calling loginUser.'); - } - var localVarPath = "/user/login"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + var localVarPath = "/user/login"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; - if (username !== undefined) { - localVarQueryParameter['username'] = username; - } + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } - if (password !== undefined) { - localVarQueryParameter['password'] = password; - } + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - /** - * - * @summary Logs out current logged in user session - * @throws {RequiredError} - */ - logoutUser: function logoutUser(options) { - var localVarPath = "/user/logout"; - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'GET' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; + /** + * + * @summary Logs out current logged in user session + * @throws {RequiredError} + */ + logoutUser: function logoutUser(options) { + var localVarPath = "/user/logout"; + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'GET' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + }, - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @throws {RequiredError} + */ + updateUser: function updateUser(username, body, options) { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username', 'Required parameter username was null or undefined when calling updateUser.'); + } // verify required parameter 'body' is not null or undefined - /** - * This can only be done by the logged in user. - * @summary Updated user - * @throws {RequiredError} - */ - updateUser: function updateUser(username, body, options) { - // verify required parameter 'username' is not null or undefined - if (username === null || username === undefined) { - throw new RequiredError('username', 'Required parameter username was null or undefined when calling updateUser.'); - } - // verify required parameter 'body' is not null or undefined - if (body === null || body === undefined) { - throw new RequiredError('body', 'Required parameter body was null or undefined when calling updateUser.'); - } - var localVarPath = "/user/{username}".replace("{" + "username" + "}", encodeURIComponent(String(username))); - var localVarUrlObj = url.parse(localVarPath, true); - var localVarRequestOptions = Object.assign({}, { method: 'PUT' }, options); - var localVarHeaderParameter = {}; - var localVarQueryParameter = {}; - localVarHeaderParameter['Content-Type'] = 'application/json'; + if (body === null || body === undefined) { + throw new RequiredError('body', 'Required parameter body was null or undefined when calling updateUser.'); + } - localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); - // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - delete localVarUrlObj.search; - localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); - var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : body || ""; + var localVarPath = "/user/{username}".replace("{".concat("username", "}"), encodeURIComponent(String(username))); + var localVarUrlObj = url.parse(localVarPath, true); + var localVarRequestOptions = Object.assign({}, { + method: 'PUT' + }, options); + var localVarHeaderParameter = {}; + var localVarQueryParameter = {}; + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 - return { - url: url.format(localVarUrlObj), - options: localVarRequestOptions - }; - } - }; + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + var needsSerialization = typeof body !== "string" || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : body || ""; + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions + }; + } + }; }; /** @@ -1041,152 +999,143 @@ export var UserApiFetchParamCreator = function UserApiFetchParamCreator(configur * @export */ export var UserApi = function UserApi(configuration) { - var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; - - var basePath = configuration && configuration.basePath || BASE_PATH; - return { - /** - * This can only be done by the logged in user. - * @summary Create user - * @throws {RequiredError} - */ - createUser: function createUser(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUser(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary Creates list of users with given input array - * @throws {RequiredError} - */ - createUsersWithArrayInput: function createUsersWithArrayInput(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithArrayInput(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary Creates list of users with given input array - * @throws {RequiredError} - */ - createUsersWithListInput: function createUsersWithListInput(body) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithListInput(body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * This can only be done by the logged in user. - * @summary Delete user - * @throws {RequiredError} - */ - deleteUser: function deleteUser(username) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).deleteUser(username, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * - * @summary Get user by user name - * @throws {RequiredError} - */ - getUserByName: function getUserByName(username) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).getUserByName(username, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * - * @summary Logs user into the system - * @throws {RequiredError} - */ - loginUser: function loginUser(username, password) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).loginUser(username, password, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response.json(); - } else { - throw response; - } - }); - }, - - /** - * - * @summary Logs out current logged in user session - * @throws {RequiredError} - */ - logoutUser: function logoutUser() { - var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).logoutUser(options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); - }, - - /** - * This can only be done by the logged in user. - * @summary Updated user - * @throws {RequiredError} - */ - updateUser: function updateUser(username, body) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - - var localVarFetchArgs = UserApiFetchParamCreator(configuration).updateUser(username, body, options); - return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { - if (response.status >= 200 && response.status < 300) { - return response; - } else { - throw response; - } - }); + var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : portableFetch; + var basePath = configuration && configuration.basePath || BASE_PATH; + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @throws {RequiredError} + */ + createUser: function createUser(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUser(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; } - }; + }); + }, + + /** + * + * @summary Creates list of users with given input array + * @throws {RequiredError} + */ + createUsersWithArrayInput: function createUsersWithArrayInput(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithArrayInput(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * + * @summary Creates list of users with given input array + * @throws {RequiredError} + */ + createUsersWithListInput: function createUsersWithListInput(body) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).createUsersWithListInput(body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @throws {RequiredError} + */ + deleteUser: function deleteUser(username) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).deleteUser(username, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * + * @summary Get user by user name + * @throws {RequiredError} + */ + getUserByName: function getUserByName(username) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).getUserByName(username, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * + * @summary Logs user into the system + * @throws {RequiredError} + */ + loginUser: function loginUser(username, password) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).loginUser(username, password, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response.json(); + } else { + throw response; + } + }); + }, + + /** + * + * @summary Logs out current logged in user session + * @throws {RequiredError} + */ + logoutUser: function logoutUser() { + var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).logoutUser(options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + }, + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @throws {RequiredError} + */ + updateUser: function updateUser(username, body) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + var localVarFetchArgs = UserApiFetchParamCreator(configuration).updateUser(username, body, options); + return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then(function (response) { + if (response.status >= 200 && response.status < 300) { + return response; + } else { + throw response; + } + }); + } + }; }; \ No newline at end of file diff --git a/samples/client/petstore/javascript-flowtyped/lib/api.js.flow b/samples/client/petstore/javascript-flowtyped/lib/api.js.flow index cd921bbc237..bc4367b6dfc 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/api.js.flow +++ b/samples/client/petstore/javascript-flowtyped/lib/api.js.flow @@ -4,7 +4,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech @@ -323,7 +323,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -515,7 +515,7 @@ export const PetApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -878,7 +878,7 @@ export const StoreApiFetchParamCreator = function (configuration?: Configuration delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -997,7 +997,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -1027,7 +1027,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -1057,7 +1057,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), @@ -1206,7 +1206,7 @@ export const UserApiFetchParamCreator = function (configuration?: Configuration) delete localVarUrlObj.search; localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; - localVarRequestOptions.body = needsSerialization ? JSON.stringify(body || {}) : (((body:any):string) || ""); + localVarRequestOptions.body = needsSerialization ? JSON.stringify(body != null ? body : {}) : (((body:any):string) || ""); return { url: url.format(localVarUrlObj), diff --git a/samples/client/petstore/javascript-flowtyped/lib/configuration.js b/samples/client/petstore/javascript-flowtyped/lib/configuration.js index 4d6e700a54d..f1670e52540 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/configuration.js +++ b/samples/client/petstore/javascript-flowtyped/lib/configuration.js @@ -1,6 +1,36 @@ -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +import _classCallCheck from "/Users/akihito1/src/github.com/ackintosh/openapi-generator-1/samples/client/petstore/javascript-flowtyped/node_modules/@babel/runtime/helpers/esm/classCallCheck"; +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI-Generator + * https://openapi-generator.tech + * Do not edit the class manually. + */ export var Configuration = +/** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + +/** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + +/** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + /** * parameter for oauth2 security * @param name security name @@ -8,60 +38,34 @@ export var Configuration = * @memberof Configuration */ -/** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ -function Configuration() { - var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - _classCallCheck(this, Configuration); - - if (param.apiKey) { - this.apiKey = param.apiKey; - } - if (param.username) { - this.username = param.username; - } - if (param.password) { - this.password = param.password; - } - if (param.accessToken) { - this.accessToken = param.accessToken; - } - if (param.basePath) { - this.basePath = param.basePath; - } -} /** * override base path * * @type {string} * @memberof Configuration */ +function Configuration() { + var param = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; -/** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ + _classCallCheck(this, Configuration); -/** - * parameter for apiKey security - * @param name security name - * @memberof Configuration - */ -; -/** - * OpenAPI Petstore - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * - * NOTE: This class is auto generated by OpenAPI-Generator - * https://openapi-generator.tech - * Do not edit the class manually. - */ \ No newline at end of file + if (param.apiKey) { + this.apiKey = param.apiKey; + } + + if (param.username) { + this.username = param.username; + } + + if (param.password) { + this.password = param.password; + } + + if (param.accessToken) { + this.accessToken = param.accessToken; + } + + if (param.basePath) { + this.basePath = param.basePath; + } +}; \ No newline at end of file diff --git a/samples/client/petstore/javascript-flowtyped/lib/configuration.js.flow b/samples/client/petstore/javascript-flowtyped/lib/configuration.js.flow index e2717b94012..690f033dd1d 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/configuration.js.flow +++ b/samples/client/petstore/javascript-flowtyped/lib/configuration.js.flow @@ -3,7 +3,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech diff --git a/samples/client/petstore/javascript-flowtyped/lib/index.js b/samples/client/petstore/javascript-flowtyped/lib/index.js index 0460f725d97..cc9361b86e8 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/index.js +++ b/samples/client/petstore/javascript-flowtyped/lib/index.js @@ -1,14 +1,12 @@ - /** * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech * Do not edit the class manually. */ - export * from "./api"; export * from "./configuration"; \ No newline at end of file diff --git a/samples/client/petstore/javascript-flowtyped/lib/index.js.flow b/samples/client/petstore/javascript-flowtyped/lib/index.js.flow index fc756135245..9864e99fec2 100644 --- a/samples/client/petstore/javascript-flowtyped/lib/index.js.flow +++ b/samples/client/petstore/javascript-flowtyped/lib/index.js.flow @@ -3,7 +3,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech diff --git a/samples/client/petstore/javascript-flowtyped/package.json b/samples/client/petstore/javascript-flowtyped/package.json index eb946480593..35f0d5bd937 100644 --- a/samples/client/petstore/javascript-flowtyped/package.json +++ b/samples/client/petstore/javascript-flowtyped/package.json @@ -22,10 +22,11 @@ "portable-fetch": "^3.0.0" }, "devDependencies": { - "babel-cli": "^6.26.0", - "babel-core": "^6.26.3", - "babel-plugin-transform-flow-strip-types": "^6.22.0", - "babel-preset-react-app": "^3.1.1", + "@babel/cli": "^7.0.0", + "@babel/core": "^7.0.0", + "@babel/plugin-transform-flow-strip-types": "^7.0.0", + "@babel/preset-flow": "^7.0.0", + "babel-preset-react-app": "^7.0.0", "flow-copy-source": "^1.3.0", "rimraf": "^2.6.2" } diff --git a/samples/client/petstore/javascript-flowtyped/src/api.js b/samples/client/petstore/javascript-flowtyped/src/api.js index a651816178b..bc4367b6dfc 100644 --- a/samples/client/petstore/javascript-flowtyped/src/api.js +++ b/samples/client/petstore/javascript-flowtyped/src/api.js @@ -4,7 +4,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech diff --git a/samples/client/petstore/javascript-flowtyped/src/configuration.js b/samples/client/petstore/javascript-flowtyped/src/configuration.js index e2717b94012..690f033dd1d 100644 --- a/samples/client/petstore/javascript-flowtyped/src/configuration.js +++ b/samples/client/petstore/javascript-flowtyped/src/configuration.js @@ -3,7 +3,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech diff --git a/samples/client/petstore/javascript-flowtyped/src/index.js b/samples/client/petstore/javascript-flowtyped/src/index.js index fc756135245..9864e99fec2 100644 --- a/samples/client/petstore/javascript-flowtyped/src/index.js +++ b/samples/client/petstore/javascript-flowtyped/src/index.js @@ -3,7 +3,7 @@ * OpenAPI Petstore * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * NOTE: This class is auto generated by OpenAPI-Generator * https://openapi-generator.tech diff --git a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md index 4b3539b38f3..47af6eedad6 100644 --- a/samples/client/petstore/javascript-promise-es6/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise-es6/docs/UserApi.md @@ -85,7 +85,7 @@ apiInstance.createUsersWithArrayInput(body).then(() => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -127,7 +127,7 @@ apiInstance.createUsersWithListInput(body).then(() => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js index 5e3cde6ee0f..4921080e947 100644 --- a/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise-es6/src/api/UserApi.js @@ -84,7 +84,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ createUsersWithArrayInputWithHttpInfo(body) { @@ -116,7 +116,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ createUsersWithArrayInput(body) { @@ -129,7 +129,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ createUsersWithListInputWithHttpInfo(body) { @@ -161,7 +161,7 @@ export default class UserApi { /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ createUsersWithListInput(body) { diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index f46f57e5987..aedc1280eab 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -87,7 +87,7 @@ apiInstance.createUsersWithArrayInput(body).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -130,7 +130,7 @@ apiInstance.createUsersWithListInput(body).then(function() { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index be4fb161284..f8c999df13b 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -598,7 +598,8 @@ ]; }; - exports.getBasePathFromSettings = function(index, variables={}) { + exports.getBasePathFromSettings = function(index, variables) { + var variables = variables || {}; var servers = this.hostSettings(); // check array index out of bound diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 49ef65019d3..fb070a51ef6 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -99,7 +99,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ this.createUsersWithArrayInputWithHttpInfo = function(body) { @@ -133,7 +133,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.createUsersWithArrayInput = function(body) { @@ -146,7 +146,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ this.createUsersWithListInputWithHttpInfo = function(body) { @@ -180,7 +180,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ this.createUsersWithListInput = function(body) { diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 55bc1a7aae9..d405c1b6d20 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -91,7 +91,7 @@ apiInstance.createUsersWithArrayInput(body, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type @@ -136,7 +136,7 @@ apiInstance.createUsersWithListInput(body, callback); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**[User]**](Array.md)| List of user object | + **body** | [**[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 6c4b08541d4..e972c2b6887 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -609,7 +609,8 @@ ]; }; - exports.getBasePathFromSettings = function(index, variables={}) { + exports.getBasePathFromSettings = function(index, variables) { + var variables = variables || {}; var servers = this.hostSettings(); // check array index out of bound diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index a65ce3b944e..a92872f7a33 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -100,7 +100,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithArrayInputCallback} callback The callback function, accepting three arguments: error, data, response */ this.createUsersWithArrayInput = function(body, callback) { @@ -142,7 +142,7 @@ /** * Creates list of users with given input array - * @param {Array.} body List of user object + * @param {Array.} body List of user object * @param {module:api/UserApi~createUsersWithListInputCallback} callback The callback function, accepting three arguments: error, data, response */ this.createUsersWithListInput = function(body, callback) { diff --git a/samples/client/petstore/kotlin-string/docs/UserApi.md b/samples/client/petstore/kotlin-string/docs/UserApi.md index 9c6055a9146..0f55f06bc62 100644 --- a/samples/client/petstore/kotlin-string/docs/UserApi.md +++ b/samples/client/petstore/kotlin-string/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md index 9c6055a9146..0f55f06bc62 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/kotlin/docs/UserApi.md b/samples/client/petstore/kotlin/docs/UserApi.md index 9c6055a9146..0f55f06bc62 100644 --- a/samples/client/petstore/kotlin/docs/UserApi.md +++ b/samples/client/petstore/kotlin/docs/UserApi.md @@ -89,7 +89,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**kotlin.Array<User>**](kotlin.Array.md)| List of user object | + **body** | [**kotlin.Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/perl/.openapi-generator/VERSION b/samples/client/petstore/perl/.openapi-generator/VERSION index afa63656064..83a328a9227 100644 --- a/samples/client/petstore/perl/.openapi-generator/VERSION +++ b/samples/client/petstore/perl/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/perl/.travis.yml b/samples/client/petstore/perl/.travis.yml new file mode 100644 index 00000000000..cdfebb90fbe --- /dev/null +++ b/samples/client/petstore/perl/.travis.yml @@ -0,0 +1,9 @@ +# https://docs.travis-ci.com/user/languages/perl/ +# + +language: perl + +perl: + - "5.28" + +sudo: false diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 292678b2f38..ee3b3777823 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -247,10 +247,12 @@ use WWW::OpenAPIClient::Object::ArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayTest; use WWW::OpenAPIClient::Object::Capitalization; use WWW::OpenAPIClient::Object::Cat; +use WWW::OpenAPIClient::Object::CatAllOf; use WWW::OpenAPIClient::Object::Category; use WWW::OpenAPIClient::Object::ClassModel; use WWW::OpenAPIClient::Object::Client; use WWW::OpenAPIClient::Object::Dog; +use WWW::OpenAPIClient::Object::DogAllOf; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; @@ -310,10 +312,12 @@ use WWW::OpenAPIClient::Object::ArrayOfNumberOnly; use WWW::OpenAPIClient::Object::ArrayTest; use WWW::OpenAPIClient::Object::Capitalization; use WWW::OpenAPIClient::Object::Cat; +use WWW::OpenAPIClient::Object::CatAllOf; use WWW::OpenAPIClient::Object::Category; use WWW::OpenAPIClient::Object::ClassModel; use WWW::OpenAPIClient::Object::Client; use WWW::OpenAPIClient::Object::Dog; +use WWW::OpenAPIClient::Object::DogAllOf; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; @@ -419,10 +423,12 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::ArrayTest](docs/ArrayTest.md) - [WWW::OpenAPIClient::Object::Capitalization](docs/Capitalization.md) - [WWW::OpenAPIClient::Object::Cat](docs/Cat.md) + - [WWW::OpenAPIClient::Object::CatAllOf](docs/CatAllOf.md) - [WWW::OpenAPIClient::Object::Category](docs/Category.md) - [WWW::OpenAPIClient::Object::ClassModel](docs/ClassModel.md) - [WWW::OpenAPIClient::Object::Client](docs/Client.md) - [WWW::OpenAPIClient::Object::Dog](docs/Dog.md) + - [WWW::OpenAPIClient::Object::DogAllOf](docs/DogAllOf.md) - [WWW::OpenAPIClient::Object::EnumArrays](docs/EnumArrays.md) - [WWW::OpenAPIClient::Object::EnumClass](docs/EnumClass.md) - [WWW::OpenAPIClient::Object::EnumTest](docs/EnumTest.md) diff --git a/samples/client/petstore/perl/docs/AnotherFakeApi.md b/samples/client/petstore/perl/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..87c9e4015b7 --- /dev/null +++ b/samples/client/petstore/perl/docs/AnotherFakeApi.md @@ -0,0 +1,60 @@ +# WWW::OpenAPIClient::AnotherFakeApi + +## Load the API package +```perl +use WWW::OpenAPIClient::Object::AnotherFakeApi; +``` + +All URIs are relative to *http://petstore.swagger.io:80/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags + + +# **call_123_test_special_tags** +> Client call_123_test_special_tags(body => $body) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::AnotherFakeApi; +my $api_instance = WWW::OpenAPIClient::AnotherFakeApi->new( +); + +my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model + +eval { + my $result = $api_instance->call_123_test_special_tags(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling AnotherFakeApi->call_123_test_special_tags: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/perl/docs/AnotherfakeApi.md b/samples/client/petstore/perl/docs/AnotherfakeApi.md index 87c9e4015b7..a0b0fd6f8ea 100644 --- a/samples/client/petstore/perl/docs/AnotherfakeApi.md +++ b/samples/client/petstore/perl/docs/AnotherfakeApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **call_123_test_special_tags** -> Client call_123_test_special_tags(body => $body) +> Client call_123_test_special_tags(client => $client) To test special tags @@ -26,10 +26,10 @@ use WWW::OpenAPIClient::AnotherFakeApi; my $api_instance = WWW::OpenAPIClient::AnotherFakeApi->new( ); -my $body = WWW::OpenAPIClient::Object::Client->new(); # Client | client model +my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->call_123_test_special_tags(body => $body); + my $result = $api_instance->call_123_test_special_tags(client => $client); print Dumper($result); }; if ($@) { @@ -41,7 +41,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Client**](Client.md)| client model | + **client** | [**Client**](Client.md)| client model | ### Return type diff --git a/samples/client/petstore/perl/docs/CatAllOf.md b/samples/client/petstore/perl/docs/CatAllOf.md new file mode 100644 index 00000000000..5c422d64439 --- /dev/null +++ b/samples/client/petstore/perl/docs/CatAllOf.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::CatAllOf + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::CatAllOf; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **boolean** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/DogAllOf.md b/samples/client/petstore/perl/docs/DogAllOf.md new file mode 100644 index 00000000000..6950ae9bba3 --- /dev/null +++ b/samples/client/petstore/perl/docs/DogAllOf.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::DogAllOf + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::DogAllOf; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 947df811624..71f47ac441d 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -405,6 +405,7 @@ my $api_instance = WWW::OpenAPIClient::FakeApi->new( # Configure HTTP basic authorization: http_basic_test username => 'YOUR_USERNAME', password => 'YOUR_PASSWORD', + ); my $number = 3.4; # double | None diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index caa7684785b..543f18109c7 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -90,7 +90,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](ARRAY.md)| List of user object | + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type @@ -133,7 +133,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](ARRAY.md)| List of user object | + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm index ed6f6470c59..e389921bd42 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm index 1220484ae4a..f99f06bd87d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm index 2d3ed6587b7..8a9952a6766 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm index 207807f7983..9bf21bd97ef 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm index abece6801b8..9ff4e14475d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/DefaultApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 1c727f64c76..5309ef4b29c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm index c55bface164..f57d72428c9 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm index 5b5e6777edb..55621de2d7b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesAnyType.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm index ee56b7242d8..b66e305d9d5 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesArray.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm index 0f80ce04ee2..0c12fffd5ba 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesBoolean.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm index cf35cb03ba4..f388c3a4d1d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm index 6ac377a0757..98ccc1329c0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesInteger.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm index ee32e481ff5..6c20cd9b4cc 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesNumber.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm index 9bcf3aeb154..79ec11321c8 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesObject.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm index bb15356f698..c91754dba18 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesString.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index d9bc7ed50de..15d93a05325 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm index 8a1cda357f0..673b1954e3b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm index 0c540b94a84..89f25673a03 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm index e4723275997..20d4ce4299f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm index cc342e699df..3ea06c42ee7 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -47,7 +47,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm index 7f05a735204..59165095981 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm index 9eba77c90c7..69f331f0ba9 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -31,6 +31,7 @@ use Date::Parse; use DateTime; use WWW::OpenAPIClient::Object::Animal; +use WWW::OpenAPIClient::Object::CatAllOf; use base ("Class::Accessor", "Class::Data::Inheritable", "WWW::OpenAPIClient::Object::Animal"); @@ -47,7 +48,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm new file mode 100644 index 00000000000..0e30dfe8a3d --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/CatAllOf.pm @@ -0,0 +1,184 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::CatAllOf; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'CatAllOf', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'declawed' => { + datatype => 'boolean', + base_name => 'declawed', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'declawed' => 'boolean' +} ); + +__PACKAGE__->attribute_map( { + 'declawed' => 'declawed' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm index e6eda282cf2..f83ccda5a96 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm index 124ecaaf8e8..6d4995336ce 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm index 9870f0b2a2a..f4989a15608 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm index 396bec58f58..5b10bbfc0ff 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -31,6 +31,7 @@ use Date::Parse; use DateTime; use WWW::OpenAPIClient::Object::Animal; +use WWW::OpenAPIClient::Object::DogAllOf; use base ("Class::Accessor", "Class::Data::Inheritable", "WWW::OpenAPIClient::Object::Animal"); @@ -47,7 +48,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm new file mode 100644 index 00000000000..df524136e74 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/DogAllOf.pm @@ -0,0 +1,184 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::DogAllOf; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + + +use base ("Class::Accessor", "Class::Data::Inheritable"); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('openapi_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new plain object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + $self->init(%args); + + return $self; +} + +# initialize the object +sub init +{ + my ($self, %args) = @_; + + foreach my $attribute (keys %{$self->attribute_map}) { + my $args_key = $self->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } +} + +# return perl hash +sub to_hash { + my $self = shift; + my $_hash = decode_json(JSON->new->convert_blessed->encode($self)); + + return $_hash; +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->openapi_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[(.+)\]$/i) { # array + my $_subclass = $1; + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif ($_type =~ /^hash\[string,(.+)\]$/i) { # hash + my $_subclass = $1; + my %_hash = (); + while (my($_key, $_element) = each %{$hash->{$_json_attribute}}) { + $_hash{$_key} = $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \%_hash; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'DogAllOf', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'breed' => { + datatype => 'string', + base_name => 'breed', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->openapi_types( { + 'breed' => 'string' +} ); + +__PACKAGE__->attribute_map( { + 'breed' => 'breed' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm index 7abbe2666e9..edbfc4b5432 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm index 31b0ba2a22e..d6b23f1dbfd 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm index 79d5102de6a..34585dee384 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -47,7 +47,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm index 6c3690620da..44d4650e543 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm index 46643834502..e31bac19a61 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -47,7 +47,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm index 8e76ee79d2c..378a588f945 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Foo.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm index 5622c742cba..3a077d8fc9b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm index 5a359791d26..cde0076373c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm index 31ee152b7b0..f8a88db2922 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HealthCheckResult.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm index 47e9d20f2ff..1b45e5c05c4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm index 387af5b5588..e725223d63a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject1.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm index 22b97d9da70..3342b60b860 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject2.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm index 13dc5e45575..c9c74e9ead6 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject3.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm index 733bcd1b0ec..8e73c5f3037 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject4.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm index f4a4fa7e18c..40a1319c861 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineObject5.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm index 079d246db55..7c9c51f0a96 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/InlineResponseDefault.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -47,7 +47,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm index 4ad74944ca9..08b426283c6 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm index 9964563a6fe..4c3c66b987f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm index 251aabe1d61..d413341cf5b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -47,7 +47,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm index e088706fe0c..fd006c5ad6b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm index 530581cc0c6..4972e0a9dba 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm index 9c00ad14894..29a78caf527 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm index 27836004746..9e538e95c7b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NullableClass.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm index 96b42362910..ab9e9d3dd40 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm index 00ed0155385..645ba74faae 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm index 0aef6dbfe90..aa5a9526aaa 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm index f20810137e7..44d1e6ca8ad 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm index 53b1d5a1620..5942b8ff798 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumDefaultValue.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm index ebc6f6d0c1b..5309a43dfa2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumInteger.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm index 49ff7d83eea..d12618951d3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnumIntegerDefaultValue.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm index dbb878f86b6..86b73132280 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -48,7 +48,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm index 96d5e1d5d9c..f04defe0d97 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm index 48d438db454..bb884cfa0de 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm index d973f5e5877..41399693422 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm index 355cf839493..69c427ec07a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderDefault.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm index 8cacd4e433c..84e327b9141 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/TypeHolderExample.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm index 44f7ff0f75f..9b86889ea42 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm index ad7e2c2695c..19523d899f1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/XmlItem.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech @@ -46,7 +46,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm index 070ab1bde33..70d56989012 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm index 22da68892cb..dea1fd81a0c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm index bc18a96fb71..db553b53a1f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm index 2d730e28e55..cfd4a0a29fc 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm index e02106644ca..3d3dfab9c7d 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm @@ -4,7 +4,7 @@ OpenAPI Petstore This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ -OpenAPI spec version: 1.0.0 +The version of the OpenAPI document: 1.0.0 Generated by: https://openapi-generator.tech diff --git a/samples/client/petstore/perl/t/AnotherFakeApiTest.t b/samples/client/petstore/perl/t/AnotherFakeApiTest.t new file mode 100644 index 00000000000..52d6452f0a3 --- /dev/null +++ b/samples/client/petstore/perl/t/AnotherFakeApiTest.t @@ -0,0 +1,41 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator +# Please update the test cases below to test the API endpoints. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 1; #TODO update number of test cases +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + +use_ok('WWW::OpenAPIClient::AnotherFakeApi'); + +my $api = WWW::OpenAPIClient::AnotherFakeApi->new(); +isa_ok($api, 'WWW::OpenAPIClient::AnotherFakeApi'); + +# +# call_123_test_special_tags test +# +{ + my $body = undef; # replace NULL with a proper value + my $result = $api->call_123_test_special_tags(body => $body); +} + + +1; diff --git a/samples/client/petstore/perl/t/CatAllOfTest.t b/samples/client/petstore/perl/t/CatAllOfTest.t new file mode 100644 index 00000000000..4cccac8672e --- /dev/null +++ b/samples/client/petstore/perl/t/CatAllOfTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::CatAllOf'); + +my $instance = WWW::OpenAPIClient::Object::CatAllOf->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::CatAllOf'); + diff --git a/samples/client/petstore/perl/t/DogAllOfTest.t b/samples/client/petstore/perl/t/DogAllOfTest.t new file mode 100644 index 00000000000..441bfc78633 --- /dev/null +++ b/samples/client/petstore/perl/t/DogAllOfTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::DogAllOf'); + +my $instance = WWW::OpenAPIClient::Object::DogAllOf->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::DogAllOf'); + diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md index 375bf0ce9f9..7cb382f9c17 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md @@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithArrayInput($body); @@ -103,7 +103,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type @@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$body = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$body = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithListInput($body); @@ -156,7 +156,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **body** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python-asyncio/docs/UserApi.md b/samples/client/petstore/python-asyncio/docs/UserApi.md index fdc2c30df9b..783bb991ce1 100644 --- a/samples/client/petstore/python-asyncio/docs/UserApi.md +++ b/samples/client/petstore/python-asyncio/docs/UserApi.md @@ -83,7 +83,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -96,7 +96,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -134,7 +134,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -147,7 +147,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python-asyncio/petstore_api/configuration.py b/samples/client/petstore/python-asyncio/petstore_api/configuration.py index fa0c3f4d320..886cf0bd9ad 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/configuration.py +++ b/samples/client/petstore/python-asyncio/petstore_api/configuration.py @@ -14,7 +14,6 @@ from __future__ import absolute_import import copy import logging -import multiprocessing import sys import urllib3 @@ -115,12 +114,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): """Set this to True/False to enable/disable SSL hostname verification. """ - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 - """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. """ self.proxy = None diff --git a/samples/client/petstore/python-asyncio/petstore_api/rest.py b/samples/client/petstore/python-asyncio/petstore_api/rest.py index d06b8459fb8..e13f81b4527 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/rest.py +++ b/samples/client/petstore/python-asyncio/petstore_api/rest.py @@ -46,8 +46,11 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=4): + def __init__(self, configuration, pools_size=4, maxsize=None): + # maxsize is number of requests to host that are allowed in parallel + if maxsize is None: + maxsize = configuration.connection_pool_maxsize # ca_certs if configuration.ssl_ca_cert: diff --git a/samples/client/petstore/python-tornado/docs/UserApi.md b/samples/client/petstore/python-tornado/docs/UserApi.md index fdc2c30df9b..783bb991ce1 100644 --- a/samples/client/petstore/python-tornado/docs/UserApi.md +++ b/samples/client/petstore/python-tornado/docs/UserApi.md @@ -83,7 +83,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -96,7 +96,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -134,7 +134,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -147,7 +147,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index fdc2c30df9b..783bb991ce1 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -83,7 +83,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -96,7 +96,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -134,7 +134,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -body = None # list[User] | List of user object +body = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -147,7 +147,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](list.md)| List of user object | + **body** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/ruby/.rubocop.yml b/samples/client/petstore/ruby/.rubocop.yml index e9f19c082d9..0ef33ce5e32 100644 --- a/samples/client/petstore/ruby/.rubocop.yml +++ b/samples/client/petstore/ruby/.rubocop.yml @@ -46,7 +46,7 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true -Layout/FirstParameterIndentation: +Layout/IndentFirstArgument: Enabled: true # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 1fa8d487e97..49a57ef5849 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -74,7 +74,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -body = nil # Array | List of user object +body = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -89,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](Array.md)| List of user object | + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -118,7 +118,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -body = nil # Array | List of user object +body = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -133,7 +133,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](Array.md)| List of user object | + **body** | [**Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 9030418701e..bf8e6ebded5 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore 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 4d63750c5f2..4aaab3a8aea 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index 4688f0797ff..b266f097747 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore 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 9d2e03fa0c1..1f6c48a31cd 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -104,7 +103,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -291,7 +290,7 @@ module Petstore 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' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -415,7 +414,7 @@ module Petstore 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' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -481,7 +480,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" end # resource path - local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -553,7 +552,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file" end # resource path - local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} 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 ec2362b7587..5e510a6c7e0 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -44,7 +43,7 @@ module Petstore 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' + '}', CGI.escape(order_id.to_s)) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -168,7 +167,7 @@ module Petstore end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} 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 50a4fa82a80..30d0aff9129 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -220,7 +219,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -278,7 +277,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -466,7 +465,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'body' when calling UserApi.update_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index a3a78d4b76f..0fd8605b4af 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -15,7 +15,6 @@ require 'json' require 'logger' require 'tempfile' require 'typhoeus' -require 'uri' module Petstore class ApiClient @@ -262,7 +261,7 @@ module Petstore def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + @config.base_url + path end # Builds the HTTP request body diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 407cd63983a..ca4eb24ee9e 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -10,8 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' - module Petstore class Configuration # Defines url scheme @@ -174,8 +172,7 @@ module Petstore end def base_url - url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') end # Gets API key (with prefix if set). diff --git a/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION +++ b/samples/client/petstore/rust-reqwest/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust-reqwest/README.md b/samples/client/petstore/rust-reqwest/README.md index 9d256c59927..d8591a2cb9f 100644 --- a/samples/client/petstore/rust-reqwest/README.md +++ b/samples/client/petstore/rust-reqwest/README.md @@ -3,6 +3,7 @@ This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. ## Overview + This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. - API version: 1.0.0 @@ -10,9 +11,11 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - Build package: org.openapitools.codegen.languages.RustClientCodegen ## Installation -Put the package under your project folder and add the following in import: + +Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`: + ``` - "./petstore_client" + openapi = { path = "./generated" } ``` ## Documentation for API Endpoints @@ -53,42 +56,10 @@ Class | Method | HTTP request | Description - [User](docs/User.md) -## Documentation For Authorization +To get access to the crate's generated documentation, use: -## api_key -- **Type**: API key - -Example ``` - auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. - }) - r, err := client.Service.Operation(auth, args) -``` -## petstore_auth -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - -Example -``` - auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING") - r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. -``` - import "golang.org/x/oauth2" - - / .. Perform OAuth2 round trip request and obtain a token .. // - - tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) - auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) - r, err := client.Service.Operation(auth, args) +cargo doc --open ``` ## Author diff --git a/samples/client/petstore/rust-reqwest/docs/ApiResponse.md b/samples/client/petstore/rust-reqwest/docs/ApiResponse.md index 3af9a16ab36..fe896d1a86d 100644 --- a/samples/client/petstore/rust-reqwest/docs/ApiResponse.md +++ b/samples/client/petstore/rust-reqwest/docs/ApiResponse.md @@ -1,6 +1,7 @@ # ApiResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **i32** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/Category.md b/samples/client/petstore/rust-reqwest/docs/Category.md index 39aaee2b052..5890848827d 100644 --- a/samples/client/petstore/rust-reqwest/docs/Category.md +++ b/samples/client/petstore/rust-reqwest/docs/Category.md @@ -1,6 +1,7 @@ # Category ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/Order.md b/samples/client/petstore/rust-reqwest/docs/Order.md index f350a8b5b4e..6d27453a76b 100644 --- a/samples/client/petstore/rust-reqwest/docs/Order.md +++ b/samples/client/petstore/rust-reqwest/docs/Order.md @@ -1,6 +1,7 @@ # Order ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/Pet.md b/samples/client/petstore/rust-reqwest/docs/Pet.md index 097c4390288..53a462e68b9 100644 --- a/samples/client/petstore/rust-reqwest/docs/Pet.md +++ b/samples/client/petstore/rust-reqwest/docs/Pet.md @@ -1,6 +1,7 @@ # Pet ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/PetApi.md b/samples/client/petstore/rust-reqwest/docs/PetApi.md index 89a95eebaf1..a74635038e7 100644 --- a/samples/client/petstore/rust-reqwest/docs/PetApi.md +++ b/samples/client/petstore/rust-reqwest/docs/PetApi.md @@ -14,12 +14,15 @@ Method | HTTP request | Description [**upload_file**](PetApi.md#upload_file) | **post** /pet/{petId}/uploadImage | uploads an image -# **add_pet** + +## add_pet + > add_pet(ctx, body) Add a new pet to the store ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -35,17 +38,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **delete_pet** + +## delete_pet + > delete_pet(ctx, pet_id, optional) Deletes a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -53,6 +59,7 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes @@ -70,12 +77,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **find_pets_by_status** + +## find_pets_by_status + > Vec<::models::Pet> find_pets_by_status(ctx, status) Finds Pets by status @@ -83,6 +92,7 @@ Multiple status values can be provided with comma separated strings ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -98,12 +108,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **find_pets_by_tags** + +## find_pets_by_tags + > Vec<::models::Pet> find_pets_by_tags(ctx, tags) Finds Pets by tags @@ -111,6 +123,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -126,12 +139,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_pet_by_id** + +## get_pet_by_id + > ::models::Pet get_pet_by_id(ctx, pet_id) Find pet by ID @@ -139,6 +154,7 @@ Returns a single pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -154,17 +170,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_pet** + +## update_pet + > update_pet(ctx, body) Update an existing pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -180,17 +199,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_pet_with_form** + +## update_pet_with_form + > update_pet_with_form(ctx, pet_id, optional) Updates a pet in the store with form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -198,6 +220,7 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes @@ -216,17 +239,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **upload_file** + +## upload_file + > ::models::ApiResponse upload_file(ctx, pet_id, optional) uploads an image ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -234,13 +260,14 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **i64**| ID of pet to update | **additional_metadata** | **String**| Additional data to pass to server | - **file** | **&std::path::Path**| file to upload | + **file** | **std::path::PathBuf**| file to upload | ### Return type @@ -252,8 +279,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust-reqwest/docs/StoreApi.md b/samples/client/petstore/rust-reqwest/docs/StoreApi.md index 7451dacfd6d..e57378b9f84 100644 --- a/samples/client/petstore/rust-reqwest/docs/StoreApi.md +++ b/samples/client/petstore/rust-reqwest/docs/StoreApi.md @@ -10,7 +10,9 @@ Method | HTTP request | Description [**place_order**](StoreApi.md#place_order) | **post** /store/order | Place an order for a pet -# **delete_order** + +## delete_order + > delete_order(order_id) Delete purchase order by ID @@ -18,6 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **String**| ID of the order that needs to be deleted | @@ -32,18 +35,21 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_inventory** + +## get_inventory + > ::std::collections::HashMap get_inventory(ctx, ) Returns pet inventories by status Returns a map of status codes to quantities ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -56,12 +62,14 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_order_by_id** + +## get_order_by_id + > ::models::Order get_order_by_id(order_id) Find purchase order by ID @@ -69,6 +77,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **i64**| ID of pet that needs to be fetched | @@ -83,17 +92,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **place_order** + +## place_order + > ::models::Order place_order(body) Place an order for a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**Order**](Order.md)| order placed for purchasing the pet | @@ -108,8 +120,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust-reqwest/docs/Tag.md b/samples/client/petstore/rust-reqwest/docs/Tag.md index d1118479b90..cc377c0ef4b 100644 --- a/samples/client/petstore/rust-reqwest/docs/Tag.md +++ b/samples/client/petstore/rust-reqwest/docs/Tag.md @@ -1,6 +1,7 @@ # Tag ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/User.md b/samples/client/petstore/rust-reqwest/docs/User.md index 33aa9693902..8f0a63847cc 100644 --- a/samples/client/petstore/rust-reqwest/docs/User.md +++ b/samples/client/petstore/rust-reqwest/docs/User.md @@ -1,6 +1,7 @@ # User ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust-reqwest/docs/UserApi.md b/samples/client/petstore/rust-reqwest/docs/UserApi.md index c6353d423e3..d469a52df88 100644 --- a/samples/client/petstore/rust-reqwest/docs/UserApi.md +++ b/samples/client/petstore/rust-reqwest/docs/UserApi.md @@ -14,7 +14,9 @@ Method | HTTP request | Description [**update_user**](UserApi.md#update_user) | **put** /user/{username} | Updated user -# **create_user** + +## create_user + > create_user(body) Create user @@ -22,6 +24,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**User**](User.md)| Created user object | @@ -36,20 +39,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **create_users_with_array_input** + +## create_users_with_array_input + > create_users_with_array_input(body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -61,20 +67,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **create_users_with_list_input** + +## create_users_with_list_input + > create_users_with_list_input(body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -86,12 +95,14 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **delete_user** + +## delete_user + > delete_user(username) Delete user @@ -99,6 +110,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The name that needs to be deleted | @@ -113,17 +125,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_user_by_name** + +## get_user_by_name + > ::models::User get_user_by_name(username) Get user by user name ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The name that needs to be fetched. Use user1 for testing. | @@ -138,17 +153,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **login_user** + +## login_user + > String login_user(username, password) Logs user into the system ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The user name for login | @@ -164,16 +182,19 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **logout_user** + +## logout_user + > logout_user() Logs out current logged in user session ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -186,12 +207,14 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_user** + +## update_user + > update_user(username, body) Updated user @@ -199,6 +222,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | @@ -214,8 +238,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust-reqwest/pom.xml b/samples/client/petstore/rust-reqwest/pom.xml index 299a9058f7c..8ef695226a9 100644 --- a/samples/client/petstore/rust-reqwest/pom.xml +++ b/samples/client/petstore/rust-reqwest/pom.xml @@ -4,7 +4,7 @@ RustReqwestPetstoreClientTests pom 1.0-SNAPSHOT - Rust Reqwest Petstore Client + Rust (reqwest) Petstore Client diff --git a/samples/client/petstore/rust-reqwest/src/apis/configuration.rs b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs index 9493b6ff9ec..4194f7a52d1 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/configuration.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/apis/mod.rs b/samples/client/petstore/rust-reqwest/src/apis/mod.rs index 99d5b323764..8ca9138588c 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/mod.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/mod.rs @@ -10,19 +10,19 @@ pub enum Error { impl From for Error { fn from(e: reqwest::Error) -> Self { - return Error::Reqwest(e) + Error::Reqwest(e) } } impl From for Error { fn from(e: serde_json::Error) -> Self { - return Error::Serde(e) + Error::Serde(e) } } impl From for Error { fn from(e: std::io::Error) -> Self { - return Error::Io(e) + Error::Io(e) } } diff --git a/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs index edea306534e..53d2b82ea72 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/pet_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -35,7 +35,7 @@ pub trait PetApi { fn get_pet_by_id(&self, pet_id: i64) -> Result<::models::Pet, Error>; fn update_pet(&self, body: ::models::Pet) -> Result<(), Error>; fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Result<(), Error>; - fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error>; + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<::models::ApiResponse, Error>; } impl PetApi for PetApiClient { @@ -197,7 +197,7 @@ impl PetApi for PetApiClient { Ok(()) } - fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Result<::models::ApiResponse, Error> { + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Result<::models::ApiResponse, Error> { let configuration: &configuration::Configuration = self.configuration.borrow(); let client = &configuration.client; diff --git a/samples/client/petstore/rust-reqwest/src/apis/store_api.rs b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs index 787072191f1..d9d60f09960 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/store_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/store_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/apis/user_api.rs b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs index ea877eb0378..68d4c9f1266 100644 --- a/samples/client/petstore/rust-reqwest/src/apis/user_api.rs +++ b/samples/client/petstore/rust-reqwest/src/apis/user_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust-reqwest/src/models/api_response.rs b/samples/client/petstore/rust-reqwest/src/models/api_response.rs index 7d33d285b87..7884fba590e 100644 --- a/samples/client/petstore/rust-reqwest/src/models/api_response.rs +++ b/samples/client/petstore/rust-reqwest/src/models/api_response.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,13 +13,14 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct ApiResponse { - #[serde(rename = "code")] + #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, - #[serde(rename = "type")] + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub _type: Option, - #[serde(rename = "message")] + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } @@ -33,3 +34,5 @@ impl ApiResponse { } } } + + diff --git a/samples/client/petstore/rust-reqwest/src/models/category.rs b/samples/client/petstore/rust-reqwest/src/models/category.rs index d18877e805f..804f9f4c707 100644 --- a/samples/client/petstore/rust-reqwest/src/models/category.rs +++ b/samples/client/petstore/rust-reqwest/src/models/category.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,11 +13,12 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Category { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "name")] + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } @@ -30,3 +31,5 @@ impl Category { } } } + + diff --git a/samples/client/petstore/rust-reqwest/src/models/order.rs b/samples/client/petstore/rust-reqwest/src/models/order.rs index f5c7ceb74d7..118dc310767 100644 --- a/samples/client/petstore/rust-reqwest/src/models/order.rs +++ b/samples/client/petstore/rust-reqwest/src/models/order.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,20 +13,21 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Order { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "petId")] + #[serde(rename = "petId", skip_serializing_if = "Option::is_none")] pub pet_id: Option, - #[serde(rename = "quantity")] + #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")] pub quantity: Option, - #[serde(rename = "shipDate")] + #[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")] pub ship_date: Option, /// Order Status - #[serde(rename = "status")] + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, - #[serde(rename = "complete")] + #[serde(rename = "complete", skip_serializing_if = "Option::is_none")] pub complete: Option, } @@ -43,3 +44,15 @@ impl Order { } } } + +/// Order Status +#[derive(Debug, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + diff --git a/samples/client/petstore/rust-reqwest/src/models/pet.rs b/samples/client/petstore/rust-reqwest/src/models/pet.rs index e7d4466d2d9..64dae06e454 100644 --- a/samples/client/petstore/rust-reqwest/src/models/pet.rs +++ b/samples/client/petstore/rust-reqwest/src/models/pet.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,20 +13,21 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Pet { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "category")] + #[serde(rename = "category", skip_serializing_if = "Option::is_none")] pub category: Option<::models::Category>, #[serde(rename = "name")] pub name: String, #[serde(rename = "photoUrls")] pub photo_urls: Vec, - #[serde(rename = "tags")] + #[serde(rename = "tags", skip_serializing_if = "Option::is_none")] pub tags: Option>, /// pet status in the store - #[serde(rename = "status")] + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, } @@ -43,3 +44,15 @@ impl Pet { } } } + +/// pet status in the store +#[derive(Debug, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "available")] + Available, + #[serde(rename = "pending")] + Pending, + #[serde(rename = "sold")] + Sold, +} + diff --git a/samples/client/petstore/rust-reqwest/src/models/tag.rs b/samples/client/petstore/rust-reqwest/src/models/tag.rs index e5964cc9ea1..503fb7f61bd 100644 --- a/samples/client/petstore/rust-reqwest/src/models/tag.rs +++ b/samples/client/petstore/rust-reqwest/src/models/tag.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,11 +13,12 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Tag { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "name")] + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } @@ -30,3 +31,5 @@ impl Tag { } } } + + diff --git a/samples/client/petstore/rust-reqwest/src/models/user.rs b/samples/client/petstore/rust-reqwest/src/models/user.rs index bfa6bfb96e4..6bfa6e2167a 100644 --- a/samples/client/petstore/rust-reqwest/src/models/user.rs +++ b/samples/client/petstore/rust-reqwest/src/models/user.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,24 +13,25 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct User { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "username")] + #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, - #[serde(rename = "firstName")] + #[serde(rename = "firstName", skip_serializing_if = "Option::is_none")] pub first_name: Option, - #[serde(rename = "lastName")] + #[serde(rename = "lastName", skip_serializing_if = "Option::is_none")] pub last_name: Option, - #[serde(rename = "email")] + #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, - #[serde(rename = "password")] + #[serde(rename = "password", skip_serializing_if = "Option::is_none")] pub password: Option, - #[serde(rename = "phone")] + #[serde(rename = "phone", skip_serializing_if = "Option::is_none")] pub phone: Option, /// User Status - #[serde(rename = "userStatus")] + #[serde(rename = "userStatus", skip_serializing_if = "Option::is_none")] pub user_status: Option, } @@ -49,3 +50,5 @@ impl User { } } } + + diff --git a/samples/client/petstore/rust/.openapi-generator/VERSION b/samples/client/petstore/rust/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/client/petstore/rust/.openapi-generator/VERSION +++ b/samples/client/petstore/rust/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust/README.md b/samples/client/petstore/rust/README.md index b18581982b2..a1149b09036 100644 --- a/samples/client/petstore/rust/README.md +++ b/samples/client/petstore/rust/README.md @@ -3,6 +3,7 @@ This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. ## Overview + This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client. - API version: 1.0.0 @@ -10,9 +11,11 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat - Build package: org.openapitools.codegen.languages.RustClientCodegen ## Installation -Put the package under your project folder and add the following in import: + +Put the package under your project folder and add the following to `Cargo.toml` under `[dependencies]`: + ``` - "./petstore_client" + openapi = { path = "./generated" } ``` ## Documentation for API Endpoints @@ -53,42 +56,10 @@ Class | Method | HTTP request | Description - [User](docs/User.md) -## Documentation For Authorization +To get access to the crate's generated documentation, use: -## api_key -- **Type**: API key - -Example ``` - auth := context.WithValue(context.TODO(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. - }) - r, err := client.Service.Operation(auth, args) -``` -## petstore_auth -- **Type**: OAuth -- **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog -- **Scopes**: - - **write:pets**: modify pets in your account - - **read:pets**: read your pets - -Example -``` - auth := context.WithValue(context.TODO(), sw.ContextAccessToken, "ACCESSTOKENSTRING") - r, err := client.Service.Operation(auth, args) -``` - -Or via OAuth2 module to automatically refresh tokens and perform user authentication. -``` - import "golang.org/x/oauth2" - - / .. Perform OAuth2 round trip request and obtain a token .. // - - tokenSource := oauth2cfg.TokenSource(createContext(httpClient), &token) - auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) - r, err := client.Service.Operation(auth, args) +cargo doc --open ``` ## Author diff --git a/samples/client/petstore/rust/docs/ApiResponse.md b/samples/client/petstore/rust/docs/ApiResponse.md index 3af9a16ab36..fe896d1a86d 100644 --- a/samples/client/petstore/rust/docs/ApiResponse.md +++ b/samples/client/petstore/rust/docs/ApiResponse.md @@ -1,6 +1,7 @@ # ApiResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **i32** | | [optional] diff --git a/samples/client/petstore/rust/docs/Category.md b/samples/client/petstore/rust/docs/Category.md index 39aaee2b052..5890848827d 100644 --- a/samples/client/petstore/rust/docs/Category.md +++ b/samples/client/petstore/rust/docs/Category.md @@ -1,6 +1,7 @@ # Category ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust/docs/Order.md b/samples/client/petstore/rust/docs/Order.md index f350a8b5b4e..6d27453a76b 100644 --- a/samples/client/petstore/rust/docs/Order.md +++ b/samples/client/petstore/rust/docs/Order.md @@ -1,6 +1,7 @@ # Order ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust/docs/Pet.md b/samples/client/petstore/rust/docs/Pet.md index 097c4390288..53a462e68b9 100644 --- a/samples/client/petstore/rust/docs/Pet.md +++ b/samples/client/petstore/rust/docs/Pet.md @@ -1,6 +1,7 @@ # Pet ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust/docs/PetApi.md b/samples/client/petstore/rust/docs/PetApi.md index 1603f57f4ee..e690c805185 100644 --- a/samples/client/petstore/rust/docs/PetApi.md +++ b/samples/client/petstore/rust/docs/PetApi.md @@ -14,12 +14,15 @@ Method | HTTP request | Description [**upload_file**](PetApi.md#upload_file) | **Post** /pet/{petId}/uploadImage | uploads an image -# **add_pet** + +## add_pet + > add_pet(ctx, body) Add a new pet to the store ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -35,17 +38,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **delete_pet** + +## delete_pet + > delete_pet(ctx, pet_id, optional) Deletes a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -53,6 +59,7 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes @@ -70,12 +77,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **find_pets_by_status** + +## find_pets_by_status + > Vec<::models::Pet> find_pets_by_status(ctx, status) Finds Pets by status @@ -83,6 +92,7 @@ Multiple status values can be provided with comma separated strings ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -98,12 +108,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **find_pets_by_tags** + +## find_pets_by_tags + > Vec<::models::Pet> find_pets_by_tags(ctx, tags) Finds Pets by tags @@ -111,6 +123,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -126,12 +139,14 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_pet_by_id** + +## get_pet_by_id + > ::models::Pet get_pet_by_id(ctx, pet_id) Find pet by ID @@ -139,6 +154,7 @@ Returns a single pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -154,17 +170,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_pet** + +## update_pet + > update_pet(ctx, body) Update an existing pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -180,17 +199,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_pet_with_form** + +## update_pet_with_form + > update_pet_with_form(ctx, pet_id, optional) Updates a pet in the store with form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -198,6 +220,7 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes @@ -216,17 +239,20 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **upload_file** + +## upload_file + > ::models::ApiResponse upload_file(ctx, pet_id, optional) uploads an image ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication @@ -234,13 +260,14 @@ Name | Type | Description | Notes **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **i64**| ID of pet to update | **additional_metadata** | **String**| Additional data to pass to server | - **file** | **&std::path::Path**| file to upload | + **file** | **std::path::PathBuf**| file to upload | ### Return type @@ -252,8 +279,8 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/StoreApi.md b/samples/client/petstore/rust/docs/StoreApi.md index 507a0c4300c..1e4bdc3e14a 100644 --- a/samples/client/petstore/rust/docs/StoreApi.md +++ b/samples/client/petstore/rust/docs/StoreApi.md @@ -10,7 +10,9 @@ Method | HTTP request | Description [**place_order**](StoreApi.md#place_order) | **Post** /store/order | Place an order for a pet -# **delete_order** + +## delete_order + > delete_order(order_id) Delete purchase order by ID @@ -18,6 +20,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **String**| ID of the order that needs to be deleted | @@ -32,18 +35,21 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_inventory** + +## get_inventory + > ::std::collections::HashMap get_inventory(ctx, ) Returns pet inventories by status Returns a map of status codes to quantities ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -56,12 +62,14 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_order_by_id** + +## get_order_by_id + > ::models::Order get_order_by_id(order_id) Find purchase order by ID @@ -69,6 +77,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_id** | **i64**| ID of pet that needs to be fetched | @@ -83,17 +92,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **place_order** + +## place_order + > ::models::Order place_order(body) Place an order for a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**Order**](Order.md)| order placed for purchasing the pet | @@ -108,8 +120,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/Tag.md b/samples/client/petstore/rust/docs/Tag.md index d1118479b90..cc377c0ef4b 100644 --- a/samples/client/petstore/rust/docs/Tag.md +++ b/samples/client/petstore/rust/docs/Tag.md @@ -1,6 +1,7 @@ # Tag ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust/docs/User.md b/samples/client/petstore/rust/docs/User.md index 33aa9693902..8f0a63847cc 100644 --- a/samples/client/petstore/rust/docs/User.md +++ b/samples/client/petstore/rust/docs/User.md @@ -1,6 +1,7 @@ # User ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **i64** | | [optional] diff --git a/samples/client/petstore/rust/docs/UserApi.md b/samples/client/petstore/rust/docs/UserApi.md index 69e7bc50627..ffa733d64de 100644 --- a/samples/client/petstore/rust/docs/UserApi.md +++ b/samples/client/petstore/rust/docs/UserApi.md @@ -14,7 +14,9 @@ Method | HTTP request | Description [**update_user**](UserApi.md#update_user) | **Put** /user/{username} | Updated user -# **create_user** + +## create_user + > create_user(body) Create user @@ -22,6 +24,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**User**](User.md)| Created user object | @@ -36,20 +39,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **create_users_with_array_input** + +## create_users_with_array_input + > create_users_with_array_input(body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -61,20 +67,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **create_users_with_list_input** + +## create_users_with_list_input + > create_users_with_list_input(body) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](array.md)| List of user object | + **body** | [**Vec<::models::User>**](User.md)| List of user object | ### Return type @@ -86,12 +95,14 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **delete_user** + +## delete_user + > delete_user(username) Delete user @@ -99,6 +110,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The name that needs to be deleted | @@ -113,17 +125,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **get_user_by_name** + +## get_user_by_name + > ::models::User get_user_by_name(username) Get user by user name ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The name that needs to be fetched. Use user1 for testing. | @@ -138,17 +153,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **login_user** + +## login_user + > String login_user(username, password) Logs user into the system ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| The user name for login | @@ -164,16 +182,19 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **logout_user** + +## logout_user + > logout_user() Logs out current logged in user session ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -186,12 +207,14 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **update_user** + +## update_user + > update_user(username, body) Updated user @@ -199,6 +222,7 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | @@ -214,8 +238,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/examples/client.rs b/samples/client/petstore/rust/examples/client.rs deleted file mode 100644 index a729ec297c5..00000000000 --- a/samples/client/petstore/rust/examples/client.rs +++ /dev/null @@ -1,39 +0,0 @@ -extern crate futures; -extern crate hyper; -extern crate petstore_client; -extern crate tokio_core; - -use futures::Future; -use hyper::client::HttpConnector; -use hyper::Client; -use tokio_core::reactor::Core; - -fn main() { - let mut core = Core::new().expect("failed to init core"); - let handle = core.handle(); - - let apicli = petstore_client::apis::client::APIClient::new( - petstore_client::apis::configuration::Configuration::new( - Client::configure() - .connector(HttpConnector::new(4, &handle)) - .build(&handle), - ), - ); - - let new_pet = petstore_client::models::Pet::new("ferris".to_owned(), vec![]).with_id(128149); - let work = apicli - .pet_api() - .add_pet(new_pet) - .and_then(|_| { - apicli - .pet_api() - .update_pet_with_form(128149, "ferris", "rusted") - }) - .and_then(|_| apicli.pet_api().get_pet_by_id(128149)) - .and_then(|pet| { - println!("pet: {:?}", pet); - futures::future::ok(()) - }); - - core.run(work).expect("failed to run core"); -} diff --git a/samples/client/petstore/rust/examples/error_handling.rs b/samples/client/petstore/rust/examples/error_handling.rs deleted file mode 100644 index dbd03d0e720..00000000000 --- a/samples/client/petstore/rust/examples/error_handling.rs +++ /dev/null @@ -1,49 +0,0 @@ -extern crate futures; -extern crate hyper; -extern crate petstore_client; -extern crate tokio_core; - -use futures::Future; -use hyper::client::HttpConnector; -use hyper::Client; -use petstore_client::apis::client::APIClient; -use petstore_client::apis::Error; -use tokio_core::reactor::Core; - -fn main() { - let mut core = Core::new().expect("failed to init core"); - let handle = core.handle(); - - let mut configuration = petstore_client::apis::configuration::Configuration::new( - Client::configure() - .connector(HttpConnector::new(4, &handle)) - .build(&handle), - ); - if let Ok(env_override) = std::env::var("PETSTORE_BASEPATH") { - configuration.base_path = env_override; - } - - let apicli = APIClient::new(configuration); - let work = apicli - .user_api() - .delete_user("404") - .then(|resp| match resp { - Ok(resp) => { - panic!(format!( - "update for nonexistent pet should fail, but got: {:?}", - resp - )); - } - Err(Error::ApiError(s)) => { - println!("got expected error: {:?}", s); - futures::future::ok::<(), ()>(()) - } - Err(Error::Hyper(e)) => { - println!("network error: {}", e); - futures::future::ok::<(), ()>(()) - } - Err(e) => panic!("unexpected error: {:?}", e), - }); - - core.run(work).expect("failed to run core"); -} diff --git a/samples/client/petstore/rust/src/apis/configuration.rs b/samples/client/petstore/rust/src/apis/configuration.rs index 4b703512133..c282a0c30df 100644 --- a/samples/client/petstore/rust/src/apis/configuration.rs +++ b/samples/client/petstore/rust/src/apis/configuration.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/apis/pet_api.rs b/samples/client/petstore/rust/src/apis/pet_api.rs index 03c00f05291..0c98efec5cf 100644 --- a/samples/client/petstore/rust/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/src/apis/pet_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -38,7 +38,7 @@ pub trait PetApi { fn get_pet_by_id(&self, pet_id: i64) -> Box>>; fn update_pet(&self, body: ::models::Pet) -> Box>>; fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box>>; - fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box>>; + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box>>; } @@ -103,7 +103,7 @@ implPetApi for PetApiClient { .execute(self.configuration.borrow()) } - fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: &std::path::Path) -> Box>> { + fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: std::path::PathBuf) -> Box>> { __internal_request::Request::new(hyper::Method::Post, "/pet/{petId}/uploadImage".to_string()) .with_auth(__internal_request::Auth::Oauth) .with_path_param("petId".to_string(), pet_id.to_string()) diff --git a/samples/client/petstore/rust/src/apis/store_api.rs b/samples/client/petstore/rust/src/apis/store_api.rs index a68411466ca..46f0bf53cf4 100644 --- a/samples/client/petstore/rust/src/apis/store_api.rs +++ b/samples/client/petstore/rust/src/apis/store_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/apis/user_api.rs b/samples/client/petstore/rust/src/apis/user_api.rs index 896bcbd5112..ba3ad140b46 100644 --- a/samples/client/petstore/rust/src/apis/user_api.rs +++ b/samples/client/petstore/rust/src/apis/user_api.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ diff --git a/samples/client/petstore/rust/src/models/api_response.rs b/samples/client/petstore/rust/src/models/api_response.rs index 7d33d285b87..7884fba590e 100644 --- a/samples/client/petstore/rust/src/models/api_response.rs +++ b/samples/client/petstore/rust/src/models/api_response.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,13 +13,14 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct ApiResponse { - #[serde(rename = "code")] + #[serde(rename = "code", skip_serializing_if = "Option::is_none")] pub code: Option, - #[serde(rename = "type")] + #[serde(rename = "type", skip_serializing_if = "Option::is_none")] pub _type: Option, - #[serde(rename = "message")] + #[serde(rename = "message", skip_serializing_if = "Option::is_none")] pub message: Option, } @@ -33,3 +34,5 @@ impl ApiResponse { } } } + + diff --git a/samples/client/petstore/rust/src/models/category.rs b/samples/client/petstore/rust/src/models/category.rs index d18877e805f..804f9f4c707 100644 --- a/samples/client/petstore/rust/src/models/category.rs +++ b/samples/client/petstore/rust/src/models/category.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,11 +13,12 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Category { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "name")] + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } @@ -30,3 +31,5 @@ impl Category { } } } + + diff --git a/samples/client/petstore/rust/src/models/inline_object.rs b/samples/client/petstore/rust/src/models/inline_object.rs deleted file mode 100644 index 2fa0cfa4f63..00000000000 --- a/samples/client/petstore/rust/src/models/inline_object.rs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * OpenAPI Petstore - * - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * - * Generated by: https://openapi-generator.tech - */ - - -#[allow(unused_imports)] -use serde_json::Value; - -#[derive(Debug, Serialize, Deserialize)] -pub struct InlineObject { - /// Updated name of the pet - #[serde(rename = "name")] - pub name: Option, - /// Updated status of the pet - #[serde(rename = "status")] - pub status: Option, -} - -impl InlineObject { - pub fn new() -> InlineObject { - InlineObject { - name: None, - status: None, - } - } -} diff --git a/samples/client/petstore/rust/src/models/inline_object_1.rs b/samples/client/petstore/rust/src/models/inline_object_1.rs deleted file mode 100644 index a7e3b098fe7..00000000000 --- a/samples/client/petstore/rust/src/models/inline_object_1.rs +++ /dev/null @@ -1,32 +0,0 @@ -/* - * OpenAPI Petstore - * - * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. - * - * OpenAPI spec version: 1.0.0 - * - * Generated by: https://openapi-generator.tech - */ - - -#[allow(unused_imports)] -use serde_json::Value; - -#[derive(Debug, Serialize, Deserialize)] -pub struct InlineObject1 { - /// Additional data to pass to server - #[serde(rename = "additionalMetadata")] - pub additional_metadata: Option, - /// file to upload - #[serde(rename = "file")] - pub file: Option<&std::path::Path>, -} - -impl InlineObject1 { - pub fn new() -> InlineObject1 { - InlineObject1 { - additional_metadata: None, - file: None, - } - } -} diff --git a/samples/client/petstore/rust/src/models/order.rs b/samples/client/petstore/rust/src/models/order.rs index f5c7ceb74d7..118dc310767 100644 --- a/samples/client/petstore/rust/src/models/order.rs +++ b/samples/client/petstore/rust/src/models/order.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,20 +13,21 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Order { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "petId")] + #[serde(rename = "petId", skip_serializing_if = "Option::is_none")] pub pet_id: Option, - #[serde(rename = "quantity")] + #[serde(rename = "quantity", skip_serializing_if = "Option::is_none")] pub quantity: Option, - #[serde(rename = "shipDate")] + #[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")] pub ship_date: Option, /// Order Status - #[serde(rename = "status")] + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, - #[serde(rename = "complete")] + #[serde(rename = "complete", skip_serializing_if = "Option::is_none")] pub complete: Option, } @@ -43,3 +44,15 @@ impl Order { } } } + +/// Order Status +#[derive(Debug, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "placed")] + Placed, + #[serde(rename = "approved")] + Approved, + #[serde(rename = "delivered")] + Delivered, +} + diff --git a/samples/client/petstore/rust/src/models/pet.rs b/samples/client/petstore/rust/src/models/pet.rs index e7d4466d2d9..64dae06e454 100644 --- a/samples/client/petstore/rust/src/models/pet.rs +++ b/samples/client/petstore/rust/src/models/pet.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,20 +13,21 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Pet { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "category")] + #[serde(rename = "category", skip_serializing_if = "Option::is_none")] pub category: Option<::models::Category>, #[serde(rename = "name")] pub name: String, #[serde(rename = "photoUrls")] pub photo_urls: Vec, - #[serde(rename = "tags")] + #[serde(rename = "tags", skip_serializing_if = "Option::is_none")] pub tags: Option>, /// pet status in the store - #[serde(rename = "status")] + #[serde(rename = "status", skip_serializing_if = "Option::is_none")] pub status: Option, } @@ -43,3 +44,15 @@ impl Pet { } } } + +/// pet status in the store +#[derive(Debug, Serialize, Deserialize)] +pub enum Status { + #[serde(rename = "available")] + Available, + #[serde(rename = "pending")] + Pending, + #[serde(rename = "sold")] + Sold, +} + diff --git a/samples/client/petstore/rust/src/models/tag.rs b/samples/client/petstore/rust/src/models/tag.rs index e5964cc9ea1..503fb7f61bd 100644 --- a/samples/client/petstore/rust/src/models/tag.rs +++ b/samples/client/petstore/rust/src/models/tag.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,11 +13,12 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct Tag { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "name")] + #[serde(rename = "name", skip_serializing_if = "Option::is_none")] pub name: Option, } @@ -30,3 +31,5 @@ impl Tag { } } } + + diff --git a/samples/client/petstore/rust/src/models/user.rs b/samples/client/petstore/rust/src/models/user.rs index bfa6bfb96e4..6bfa6e2167a 100644 --- a/samples/client/petstore/rust/src/models/user.rs +++ b/samples/client/petstore/rust/src/models/user.rs @@ -3,7 +3,7 @@ * * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. * - * OpenAPI spec version: 1.0.0 + * The version of the OpenAPI document: 1.0.0 * * Generated by: https://openapi-generator.tech */ @@ -13,24 +13,25 @@ #[allow(unused_imports)] use serde_json::Value; + #[derive(Debug, Serialize, Deserialize)] pub struct User { - #[serde(rename = "id")] + #[serde(rename = "id", skip_serializing_if = "Option::is_none")] pub id: Option, - #[serde(rename = "username")] + #[serde(rename = "username", skip_serializing_if = "Option::is_none")] pub username: Option, - #[serde(rename = "firstName")] + #[serde(rename = "firstName", skip_serializing_if = "Option::is_none")] pub first_name: Option, - #[serde(rename = "lastName")] + #[serde(rename = "lastName", skip_serializing_if = "Option::is_none")] pub last_name: Option, - #[serde(rename = "email")] + #[serde(rename = "email", skip_serializing_if = "Option::is_none")] pub email: Option, - #[serde(rename = "password")] + #[serde(rename = "password", skip_serializing_if = "Option::is_none")] pub password: Option, - #[serde(rename = "phone")] + #[serde(rename = "phone", skip_serializing_if = "Option::is_none")] pub phone: Option, /// User Status - #[serde(rename = "userStatus")] + #[serde(rename = "userStatus", skip_serializing_if = "Option::is_none")] pub user_status: Option, } @@ -49,3 +50,5 @@ impl User { } } } + + diff --git a/samples/client/petstore/spring-stubs/pom.xml b/samples/client/petstore/spring-stubs/pom.xml index a86dc3be43f..18b3dc2308d 100644 --- a/samples/client/petstore/spring-stubs/pom.xml +++ b/samples/client/petstore/spring-stubs/pom.xml @@ -35,6 +35,11 @@ springfox-swagger-ui ${springfox-version}
+ + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts index dab74f1d7bf..8f8db90ce78 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/PetApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { ApiResponse, Pet, @@ -63,31 +63,27 @@ export class PetApi extends BaseAPI { /** * Add a new pet to the store */ - addPet(requestParameters: AddPetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); - } + addPet = (requestParameters: AddPetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'addPet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -95,33 +91,27 @@ export class PetApi extends BaseAPI { /** * Deletes a pet */ - deletePet(requestParameters: DeletePetRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); - } + deletePet = (requestParameters: DeletePetRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'deletePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { - headerParameters['api_key'] = String(requestParameters.apiKey); - } - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + ...(requestParameters.apiKey && { 'api_key': String(requestParameters.apiKey) }), // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -129,33 +119,27 @@ export class PetApi extends BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - findPetsByStatus(requestParameters: FindPetsByStatusRequest): Observable> { - if (requestParameters.status === null || requestParameters.status === undefined) { - throw new RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); - } + findPetsByStatus = (requestParameters: FindPetsByStatusRequest): Observable> => { + throwIfRequired(requestParameters, 'status', 'findPetsByStatus'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.status && { 'status': requestParameters.status.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByStatus`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -163,33 +147,27 @@ export class PetApi extends BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - findPetsByTags(requestParameters: FindPetsByTagsRequest): Observable> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { - throw new RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); - } + findPetsByTags = (requestParameters: FindPetsByTagsRequest): Observable> => { + throwIfRequired(requestParameters, 'tags', 'findPetsByTags'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.tags && { 'tags': requestParameters.tags.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByTags`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -197,55 +175,48 @@ export class PetApi extends BaseAPI { * Returns a single pet * Find pet by ID */ - getPetById(requestParameters: GetPetByIdRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); - } + getPetById = (requestParameters: GetPetByIdRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'getPetById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Update an existing pet */ - updatePet(requestParameters: UpdatePetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); - } + updatePet = (requestParameters: UpdatePetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'updatePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -253,23 +224,20 @@ export class PetApi extends BaseAPI { /** * Updates a pet in the store with form data */ - updatePetWithForm(requestParameters: UpdatePetWithFormRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); - } + updatePetWithForm = (requestParameters: UpdatePetWithFormRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'updatePetWithForm'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.name !== undefined) { @@ -281,10 +249,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -292,23 +260,20 @@ export class PetApi extends BaseAPI { /** * uploads an image */ - uploadFile(requestParameters: UploadFileRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); - } + uploadFile = (requestParameters: UploadFileRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'uploadFile'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.additionalMetadata !== undefined) { @@ -320,10 +285,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -331,9 +296,9 @@ export class PetApi extends BaseAPI { } /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum FindPetsByStatusStatusEnum { Available = 'available', Pending = 'pending', diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts index c0755e5c98f..d7350a81516 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/StoreApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { Order, } from '../models'; @@ -38,20 +38,20 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - deleteOrder(requestParameters: DeleteOrderRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); - } + deleteOrder = (requestParameters: DeleteOrderRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'deleteOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -59,20 +59,20 @@ export class StoreApi extends BaseAPI { * Returns a map of status codes to quantities * Returns pet inventories by status */ - getInventory(): Observable<{ [key: string]: number; }> { - const queryParameters: HttpQuery = {}; + getInventory = (): Observable<{ [key: string]: number; }> => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request<{ [key: string]: number; }>({ path: `/store/inventory`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -80,42 +80,41 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - getOrderById(requestParameters: GetOrderByIdRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); - } + getOrderById = (requestParameters: GetOrderByIdRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'getOrderById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Place an order for a pet */ - placeOrder(requestParameters: PlaceOrderRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); - } + placeOrder = (requestParameters: PlaceOrderRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'placeOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/store/order`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts index dee6c06cbea..8b994caf6c8 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/apis/UserApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { User, } from '../models'; @@ -56,22 +56,21 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Create user */ - createUser(requestParameters: CreateUserRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); - } + createUser = (requestParameters: CreateUserRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -79,22 +78,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); - } + createUsersWithArrayInput = (requestParameters: CreateUsersWithArrayInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithArrayInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithArray`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -102,22 +100,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); - } + createUsersWithListInput = (requestParameters: CreateUsersWithListInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithListInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithList`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -126,88 +123,82 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Delete user */ - deleteUser(requestParameters: DeleteUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); - } + deleteUser = (requestParameters: DeleteUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'deleteUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Get user by user name */ - getUserByName(requestParameters: GetUserByNameRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); - } + getUserByName = (requestParameters: GetUserByNameRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'getUserByName'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs user into the system */ - loginUser(requestParameters: LoginUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); - } + loginUser = (requestParameters: LoginUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'loginUser'); + throwIfRequired(requestParameters, 'password', 'loginUser'); - if (requestParameters.password === null || requestParameters.password === undefined) { - throw new RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); - } + const headers: HttpHeaders = { + }; - const queryParameters: HttpQuery = {}; - - if (requestParameters.username !== undefined && requestParameters.username !== null) { - queryParameters['username'] = requestParameters.username; - } - - if (requestParameters.password !== undefined && requestParameters.password !== null) { - queryParameters['password'] = requestParameters.password; - } - - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + ...(requestParameters.username && { 'username': requestParameters.username }), + ...(requestParameters.password && { 'password': requestParameters.password }), + }; return this.request({ path: `/user/login`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs out current logged in user session */ - logoutUser(): Observable { - const queryParameters: HttpQuery = {}; + logoutUser = (): Observable => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + }; + + const query: HttpQuery = { + }; return this.request({ path: `/user/logout`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -215,26 +206,22 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Updated user */ - updateUser(requestParameters: UpdateUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); - } + updateUser = (requestParameters: UpdateUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'updateUser'); + throwIfRequired(requestParameters, 'body', 'updateUser'); - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); - } + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts index e28e284bf19..1d160d5d379 100644 --- a/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/default/runtime.ts @@ -66,30 +66,26 @@ export class Configuration { * This is the base class for all generated API classes. */ export class BaseAPI { - private middleware: Middleware[]; + private middleware: Middleware[] = []; constructor(protected configuration = new Configuration()) { this.middleware = configuration.middleware; } - withMiddleware(this: T, ...middlewares: Middleware[]) { + withMiddleware = (middlewares: Middleware[]) => { const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); + next.middleware = next.middleware.concat(middlewares); return next; } - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } + withPreMiddleware = (preMiddlewares: Array) => + this.withMiddleware(preMiddlewares.map((pre) => ({ pre }))); - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } + withPostMiddleware = (postMiddlewares: Array) => + this.withMiddleware(postMiddlewares.map((post) => ({ post }))); - protected request(context: RequestOpts): Observable { - return this.rxjsRequest(this.createRequestArgs(context)).pipe( + protected request = (context: RequestOpts): Observable => + this.rxjsRequest(this.createRequestArgs(context)).pipe( map((res) => { if (res.status >= 200 && res.status < 300) { return res.response as T; @@ -97,15 +93,14 @@ export class BaseAPI { throw res; }) ); - } - private createRequestArgs(context: RequestOpts): RequestArgs { + private createRequestArgs = (context: RequestOpts): RequestArgs => { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. + // only add the queryString to the URL if there are query parameters. // this is done to avoid urls ending with a '?' character which buggy webservers // do not handle correctly sometimes. - url += '?' + querystring(context.query); + url += '?' + queryString(context.query); } const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body); const options = { @@ -116,9 +111,9 @@ export class BaseAPI { return { url, options }; } - private rxjsRequest(params: RequestContext): Observable { - const preMiddlewares = this.middleware && this.middleware.filter((item) => item.pre); - const postMiddlewares = this.middleware && this.middleware.filter((item) => item.post); + private rxjsRequest = (params: RequestContext): Observable => { + const preMiddlewares = this.middleware.filter((item) => item.pre); + const postMiddlewares = this.middleware.filter((item) => item.post); return of(params).pipe( map((args) => { @@ -144,19 +139,13 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } + private clone = (): T => + Object.assign(Object.create(Object.getPrototypeOf(this)), this) } +// export for not being a breaking change export class RequiredError extends Error { name: 'RequiredError' = 'RequiredError'; - constructor(public field: string, msg?: string) { - super(msg); - } } export const COLLECTION_FORMATS = { @@ -186,17 +175,24 @@ export interface RequestOpts { body?: HttpBody; } -export function querystring(params: HttpQuery): string { - return Object.keys(params) - .map((key) => { - const value = params[key]; - if (value instanceof Array) { - return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) - .join('&'); - } - return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; - }) - .join('&'); +const queryString = (params: HttpQuery): string => Object.keys(params) + .map((key) => { + const value = params[key]; + if (value instanceof Array) { + return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) + .join('&'); + } + return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; + }) + .join('&'); + +// alias fallback for not being a breaking change +export const querystring = queryString; + +export const throwIfRequired = (params: {[key: string]: any}, key: string, nickname: string) => { + if (!params || params[key] === null || params[key] === undefined) { + throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`); + } } export interface RequestContext extends RequestArgs {} diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts index dab74f1d7bf..8f8db90ce78 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/PetApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { ApiResponse, Pet, @@ -63,31 +63,27 @@ export class PetApi extends BaseAPI { /** * Add a new pet to the store */ - addPet(requestParameters: AddPetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); - } + addPet = (requestParameters: AddPetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'addPet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -95,33 +91,27 @@ export class PetApi extends BaseAPI { /** * Deletes a pet */ - deletePet(requestParameters: DeletePetRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); - } + deletePet = (requestParameters: DeletePetRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'deletePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { - headerParameters['api_key'] = String(requestParameters.apiKey); - } - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + ...(requestParameters.apiKey && { 'api_key': String(requestParameters.apiKey) }), // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -129,33 +119,27 @@ export class PetApi extends BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - findPetsByStatus(requestParameters: FindPetsByStatusRequest): Observable> { - if (requestParameters.status === null || requestParameters.status === undefined) { - throw new RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); - } + findPetsByStatus = (requestParameters: FindPetsByStatusRequest): Observable> => { + throwIfRequired(requestParameters, 'status', 'findPetsByStatus'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.status && { 'status': requestParameters.status.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByStatus`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -163,33 +147,27 @@ export class PetApi extends BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - findPetsByTags(requestParameters: FindPetsByTagsRequest): Observable> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { - throw new RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); - } + findPetsByTags = (requestParameters: FindPetsByTagsRequest): Observable> => { + throwIfRequired(requestParameters, 'tags', 'findPetsByTags'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.tags && { 'tags': requestParameters.tags.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByTags`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -197,55 +175,48 @@ export class PetApi extends BaseAPI { * Returns a single pet * Find pet by ID */ - getPetById(requestParameters: GetPetByIdRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); - } + getPetById = (requestParameters: GetPetByIdRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'getPetById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Update an existing pet */ - updatePet(requestParameters: UpdatePetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); - } + updatePet = (requestParameters: UpdatePetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'updatePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -253,23 +224,20 @@ export class PetApi extends BaseAPI { /** * Updates a pet in the store with form data */ - updatePetWithForm(requestParameters: UpdatePetWithFormRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); - } + updatePetWithForm = (requestParameters: UpdatePetWithFormRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'updatePetWithForm'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.name !== undefined) { @@ -281,10 +249,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -292,23 +260,20 @@ export class PetApi extends BaseAPI { /** * uploads an image */ - uploadFile(requestParameters: UploadFileRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); - } + uploadFile = (requestParameters: UploadFileRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'uploadFile'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.additionalMetadata !== undefined) { @@ -320,10 +285,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -331,9 +296,9 @@ export class PetApi extends BaseAPI { } /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum FindPetsByStatusStatusEnum { Available = 'available', Pending = 'pending', diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts index c0755e5c98f..d7350a81516 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/StoreApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { Order, } from '../models'; @@ -38,20 +38,20 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - deleteOrder(requestParameters: DeleteOrderRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); - } + deleteOrder = (requestParameters: DeleteOrderRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'deleteOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -59,20 +59,20 @@ export class StoreApi extends BaseAPI { * Returns a map of status codes to quantities * Returns pet inventories by status */ - getInventory(): Observable<{ [key: string]: number; }> { - const queryParameters: HttpQuery = {}; + getInventory = (): Observable<{ [key: string]: number; }> => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request<{ [key: string]: number; }>({ path: `/store/inventory`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -80,42 +80,41 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - getOrderById(requestParameters: GetOrderByIdRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); - } + getOrderById = (requestParameters: GetOrderByIdRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'getOrderById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Place an order for a pet */ - placeOrder(requestParameters: PlaceOrderRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); - } + placeOrder = (requestParameters: PlaceOrderRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'placeOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/store/order`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts index dee6c06cbea..8b994caf6c8 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/apis/UserApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { User, } from '../models'; @@ -56,22 +56,21 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Create user */ - createUser(requestParameters: CreateUserRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); - } + createUser = (requestParameters: CreateUserRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -79,22 +78,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); - } + createUsersWithArrayInput = (requestParameters: CreateUsersWithArrayInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithArrayInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithArray`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -102,22 +100,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); - } + createUsersWithListInput = (requestParameters: CreateUsersWithListInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithListInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithList`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -126,88 +123,82 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Delete user */ - deleteUser(requestParameters: DeleteUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); - } + deleteUser = (requestParameters: DeleteUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'deleteUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Get user by user name */ - getUserByName(requestParameters: GetUserByNameRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); - } + getUserByName = (requestParameters: GetUserByNameRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'getUserByName'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs user into the system */ - loginUser(requestParameters: LoginUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); - } + loginUser = (requestParameters: LoginUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'loginUser'); + throwIfRequired(requestParameters, 'password', 'loginUser'); - if (requestParameters.password === null || requestParameters.password === undefined) { - throw new RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); - } + const headers: HttpHeaders = { + }; - const queryParameters: HttpQuery = {}; - - if (requestParameters.username !== undefined && requestParameters.username !== null) { - queryParameters['username'] = requestParameters.username; - } - - if (requestParameters.password !== undefined && requestParameters.password !== null) { - queryParameters['password'] = requestParameters.password; - } - - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + ...(requestParameters.username && { 'username': requestParameters.username }), + ...(requestParameters.password && { 'password': requestParameters.password }), + }; return this.request({ path: `/user/login`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs out current logged in user session */ - logoutUser(): Observable { - const queryParameters: HttpQuery = {}; + logoutUser = (): Observable => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + }; + + const query: HttpQuery = { + }; return this.request({ path: `/user/logout`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -215,26 +206,22 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Updated user */ - updateUser(requestParameters: UpdateUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); - } + updateUser = (requestParameters: UpdateUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'updateUser'); + throwIfRequired(requestParameters, 'body', 'updateUser'); - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); - } + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts index e28e284bf19..1d160d5d379 100644 --- a/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/es6-target/runtime.ts @@ -66,30 +66,26 @@ export class Configuration { * This is the base class for all generated API classes. */ export class BaseAPI { - private middleware: Middleware[]; + private middleware: Middleware[] = []; constructor(protected configuration = new Configuration()) { this.middleware = configuration.middleware; } - withMiddleware(this: T, ...middlewares: Middleware[]) { + withMiddleware = (middlewares: Middleware[]) => { const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); + next.middleware = next.middleware.concat(middlewares); return next; } - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } + withPreMiddleware = (preMiddlewares: Array) => + this.withMiddleware(preMiddlewares.map((pre) => ({ pre }))); - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } + withPostMiddleware = (postMiddlewares: Array) => + this.withMiddleware(postMiddlewares.map((post) => ({ post }))); - protected request(context: RequestOpts): Observable { - return this.rxjsRequest(this.createRequestArgs(context)).pipe( + protected request = (context: RequestOpts): Observable => + this.rxjsRequest(this.createRequestArgs(context)).pipe( map((res) => { if (res.status >= 200 && res.status < 300) { return res.response as T; @@ -97,15 +93,14 @@ export class BaseAPI { throw res; }) ); - } - private createRequestArgs(context: RequestOpts): RequestArgs { + private createRequestArgs = (context: RequestOpts): RequestArgs => { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. + // only add the queryString to the URL if there are query parameters. // this is done to avoid urls ending with a '?' character which buggy webservers // do not handle correctly sometimes. - url += '?' + querystring(context.query); + url += '?' + queryString(context.query); } const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body); const options = { @@ -116,9 +111,9 @@ export class BaseAPI { return { url, options }; } - private rxjsRequest(params: RequestContext): Observable { - const preMiddlewares = this.middleware && this.middleware.filter((item) => item.pre); - const postMiddlewares = this.middleware && this.middleware.filter((item) => item.post); + private rxjsRequest = (params: RequestContext): Observable => { + const preMiddlewares = this.middleware.filter((item) => item.pre); + const postMiddlewares = this.middleware.filter((item) => item.post); return of(params).pipe( map((args) => { @@ -144,19 +139,13 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } + private clone = (): T => + Object.assign(Object.create(Object.getPrototypeOf(this)), this) } +// export for not being a breaking change export class RequiredError extends Error { name: 'RequiredError' = 'RequiredError'; - constructor(public field: string, msg?: string) { - super(msg); - } } export const COLLECTION_FORMATS = { @@ -186,17 +175,24 @@ export interface RequestOpts { body?: HttpBody; } -export function querystring(params: HttpQuery): string { - return Object.keys(params) - .map((key) => { - const value = params[key]; - if (value instanceof Array) { - return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) - .join('&'); - } - return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; - }) - .join('&'); +const queryString = (params: HttpQuery): string => Object.keys(params) + .map((key) => { + const value = params[key]; + if (value instanceof Array) { + return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) + .join('&'); + } + return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; + }) + .join('&'); + +// alias fallback for not being a breaking change +export const querystring = queryString; + +export const throwIfRequired = (params: {[key: string]: any}, key: string, nickname: string) => { + if (!params || params[key] === null || params[key] === undefined) { + throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`); + } } export interface RequestContext extends RequestArgs {} diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts index dab74f1d7bf..8f8db90ce78 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/PetApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { ApiResponse, Pet, @@ -63,31 +63,27 @@ export class PetApi extends BaseAPI { /** * Add a new pet to the store */ - addPet(requestParameters: AddPetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); - } + addPet = (requestParameters: AddPetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'addPet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -95,33 +91,27 @@ export class PetApi extends BaseAPI { /** * Deletes a pet */ - deletePet(requestParameters: DeletePetRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); - } + deletePet = (requestParameters: DeletePetRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'deletePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { - headerParameters['api_key'] = String(requestParameters.apiKey); - } - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + ...(requestParameters.apiKey && { 'api_key': String(requestParameters.apiKey) }), // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -129,33 +119,27 @@ export class PetApi extends BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - findPetsByStatus(requestParameters: FindPetsByStatusRequest): Observable> { - if (requestParameters.status === null || requestParameters.status === undefined) { - throw new RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); - } + findPetsByStatus = (requestParameters: FindPetsByStatusRequest): Observable> => { + throwIfRequired(requestParameters, 'status', 'findPetsByStatus'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.status && { 'status': requestParameters.status.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByStatus`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -163,33 +147,27 @@ export class PetApi extends BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - findPetsByTags(requestParameters: FindPetsByTagsRequest): Observable> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { - throw new RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); - } + findPetsByTags = (requestParameters: FindPetsByTagsRequest): Observable> => { + throwIfRequired(requestParameters, 'tags', 'findPetsByTags'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.tags && { 'tags': requestParameters.tags.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByTags`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -197,55 +175,48 @@ export class PetApi extends BaseAPI { * Returns a single pet * Find pet by ID */ - getPetById(requestParameters: GetPetByIdRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); - } + getPetById = (requestParameters: GetPetByIdRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'getPetById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Update an existing pet */ - updatePet(requestParameters: UpdatePetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); - } + updatePet = (requestParameters: UpdatePetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'updatePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -253,23 +224,20 @@ export class PetApi extends BaseAPI { /** * Updates a pet in the store with form data */ - updatePetWithForm(requestParameters: UpdatePetWithFormRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); - } + updatePetWithForm = (requestParameters: UpdatePetWithFormRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'updatePetWithForm'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.name !== undefined) { @@ -281,10 +249,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -292,23 +260,20 @@ export class PetApi extends BaseAPI { /** * uploads an image */ - uploadFile(requestParameters: UploadFileRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); - } + uploadFile = (requestParameters: UploadFileRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'uploadFile'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.additionalMetadata !== undefined) { @@ -320,10 +285,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -331,9 +296,9 @@ export class PetApi extends BaseAPI { } /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum FindPetsByStatusStatusEnum { Available = 'available', Pending = 'pending', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts index c0755e5c98f..d7350a81516 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/StoreApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { Order, } from '../models'; @@ -38,20 +38,20 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - deleteOrder(requestParameters: DeleteOrderRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); - } + deleteOrder = (requestParameters: DeleteOrderRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'deleteOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -59,20 +59,20 @@ export class StoreApi extends BaseAPI { * Returns a map of status codes to quantities * Returns pet inventories by status */ - getInventory(): Observable<{ [key: string]: number; }> { - const queryParameters: HttpQuery = {}; + getInventory = (): Observable<{ [key: string]: number; }> => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request<{ [key: string]: number; }>({ path: `/store/inventory`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -80,42 +80,41 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - getOrderById(requestParameters: GetOrderByIdRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); - } + getOrderById = (requestParameters: GetOrderByIdRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'getOrderById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Place an order for a pet */ - placeOrder(requestParameters: PlaceOrderRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); - } + placeOrder = (requestParameters: PlaceOrderRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'placeOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/store/order`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts index dee6c06cbea..8b994caf6c8 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/apis/UserApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { User, } from '../models'; @@ -56,22 +56,21 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Create user */ - createUser(requestParameters: CreateUserRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); - } + createUser = (requestParameters: CreateUserRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -79,22 +78,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); - } + createUsersWithArrayInput = (requestParameters: CreateUsersWithArrayInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithArrayInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithArray`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -102,22 +100,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); - } + createUsersWithListInput = (requestParameters: CreateUsersWithListInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithListInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithList`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -126,88 +123,82 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Delete user */ - deleteUser(requestParameters: DeleteUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); - } + deleteUser = (requestParameters: DeleteUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'deleteUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Get user by user name */ - getUserByName(requestParameters: GetUserByNameRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); - } + getUserByName = (requestParameters: GetUserByNameRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'getUserByName'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs user into the system */ - loginUser(requestParameters: LoginUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); - } + loginUser = (requestParameters: LoginUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'loginUser'); + throwIfRequired(requestParameters, 'password', 'loginUser'); - if (requestParameters.password === null || requestParameters.password === undefined) { - throw new RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); - } + const headers: HttpHeaders = { + }; - const queryParameters: HttpQuery = {}; - - if (requestParameters.username !== undefined && requestParameters.username !== null) { - queryParameters['username'] = requestParameters.username; - } - - if (requestParameters.password !== undefined && requestParameters.password !== null) { - queryParameters['password'] = requestParameters.password; - } - - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + ...(requestParameters.username && { 'username': requestParameters.username }), + ...(requestParameters.password && { 'password': requestParameters.password }), + }; return this.request({ path: `/user/login`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs out current logged in user session */ - logoutUser(): Observable { - const queryParameters: HttpQuery = {}; + logoutUser = (): Observable => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + }; + + const query: HttpQuery = { + }; return this.request({ path: `/user/logout`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -215,26 +206,22 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Updated user */ - updateUser(requestParameters: UpdateUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); - } + updateUser = (requestParameters: UpdateUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'updateUser'); + throwIfRequired(requestParameters, 'body', 'updateUser'); - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); - } + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts index e28e284bf19..1d160d5d379 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-interfaces/runtime.ts @@ -66,30 +66,26 @@ export class Configuration { * This is the base class for all generated API classes. */ export class BaseAPI { - private middleware: Middleware[]; + private middleware: Middleware[] = []; constructor(protected configuration = new Configuration()) { this.middleware = configuration.middleware; } - withMiddleware(this: T, ...middlewares: Middleware[]) { + withMiddleware = (middlewares: Middleware[]) => { const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); + next.middleware = next.middleware.concat(middlewares); return next; } - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } + withPreMiddleware = (preMiddlewares: Array) => + this.withMiddleware(preMiddlewares.map((pre) => ({ pre }))); - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } + withPostMiddleware = (postMiddlewares: Array) => + this.withMiddleware(postMiddlewares.map((post) => ({ post }))); - protected request(context: RequestOpts): Observable { - return this.rxjsRequest(this.createRequestArgs(context)).pipe( + protected request = (context: RequestOpts): Observable => + this.rxjsRequest(this.createRequestArgs(context)).pipe( map((res) => { if (res.status >= 200 && res.status < 300) { return res.response as T; @@ -97,15 +93,14 @@ export class BaseAPI { throw res; }) ); - } - private createRequestArgs(context: RequestOpts): RequestArgs { + private createRequestArgs = (context: RequestOpts): RequestArgs => { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. + // only add the queryString to the URL if there are query parameters. // this is done to avoid urls ending with a '?' character which buggy webservers // do not handle correctly sometimes. - url += '?' + querystring(context.query); + url += '?' + queryString(context.query); } const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body); const options = { @@ -116,9 +111,9 @@ export class BaseAPI { return { url, options }; } - private rxjsRequest(params: RequestContext): Observable { - const preMiddlewares = this.middleware && this.middleware.filter((item) => item.pre); - const postMiddlewares = this.middleware && this.middleware.filter((item) => item.post); + private rxjsRequest = (params: RequestContext): Observable => { + const preMiddlewares = this.middleware.filter((item) => item.pre); + const postMiddlewares = this.middleware.filter((item) => item.post); return of(params).pipe( map((args) => { @@ -144,19 +139,13 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } + private clone = (): T => + Object.assign(Object.create(Object.getPrototypeOf(this)), this) } +// export for not being a breaking change export class RequiredError extends Error { name: 'RequiredError' = 'RequiredError'; - constructor(public field: string, msg?: string) { - super(msg); - } } export const COLLECTION_FORMATS = { @@ -186,17 +175,24 @@ export interface RequestOpts { body?: HttpBody; } -export function querystring(params: HttpQuery): string { - return Object.keys(params) - .map((key) => { - const value = params[key]; - if (value instanceof Array) { - return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) - .join('&'); - } - return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; - }) - .join('&'); +const queryString = (params: HttpQuery): string => Object.keys(params) + .map((key) => { + const value = params[key]; + if (value instanceof Array) { + return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) + .join('&'); + } + return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; + }) + .join('&'); + +// alias fallback for not being a breaking change +export const querystring = queryString; + +export const throwIfRequired = (params: {[key: string]: any}, key: string, nickname: string) => { + if (!params || params[key] === null || params[key] === undefined) { + throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`); + } } export interface RequestContext extends RequestArgs {} diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts index dab74f1d7bf..8f8db90ce78 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/PetApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { ApiResponse, Pet, @@ -63,31 +63,27 @@ export class PetApi extends BaseAPI { /** * Add a new pet to the store */ - addPet(requestParameters: AddPetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling addPet.'); - } + addPet = (requestParameters: AddPetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'addPet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -95,33 +91,27 @@ export class PetApi extends BaseAPI { /** * Deletes a pet */ - deletePet(requestParameters: DeletePetRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling deletePet.'); - } + deletePet = (requestParameters: DeletePetRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'deletePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (requestParameters.apiKey !== undefined && requestParameters.apiKey !== null) { - headerParameters['api_key'] = String(requestParameters.apiKey); - } - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + ...(requestParameters.apiKey && { 'api_key': String(requestParameters.apiKey) }), // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -129,33 +119,27 @@ export class PetApi extends BaseAPI { * Multiple status values can be provided with comma separated strings * Finds Pets by status */ - findPetsByStatus(requestParameters: FindPetsByStatusRequest): Observable> { - if (requestParameters.status === null || requestParameters.status === undefined) { - throw new RequiredError('status','Required parameter requestParameters.status was null or undefined when calling findPetsByStatus.'); - } + findPetsByStatus = (requestParameters: FindPetsByStatusRequest): Observable> => { + throwIfRequired(requestParameters, 'status', 'findPetsByStatus'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.status) { - queryParameters['status'] = requestParameters.status.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.status && { 'status': requestParameters.status.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByStatus`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -163,33 +147,27 @@ export class PetApi extends BaseAPI { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * Finds Pets by tags */ - findPetsByTags(requestParameters: FindPetsByTagsRequest): Observable> { - if (requestParameters.tags === null || requestParameters.tags === undefined) { - throw new RequiredError('tags','Required parameter requestParameters.tags was null or undefined when calling findPetsByTags.'); - } + findPetsByTags = (requestParameters: FindPetsByTagsRequest): Observable> => { + throwIfRequired(requestParameters, 'tags', 'findPetsByTags'); - const queryParameters: HttpQuery = {}; - - if (requestParameters.tags) { - queryParameters['tags'] = requestParameters.tags.join(COLLECTION_FORMATS["csv"]); - } - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + ...(requestParameters.tags && { 'tags': requestParameters.tags.join(COLLECTION_FORMATS['csv']) }), + }; return this.request>({ path: `/pet/findByTags`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -197,55 +175,48 @@ export class PetApi extends BaseAPI { * Returns a single pet * Find pet by ID */ - getPetById(requestParameters: GetPetByIdRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling getPetById.'); - } + getPetById = (requestParameters: GetPetByIdRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'getPetById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Update an existing pet */ - updatePet(requestParameters: UpdatePetRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updatePet.'); - } + updatePet = (requestParameters: UpdatePetRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'updatePet'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { + 'Content-Type': 'application/json', // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; return this.request({ path: `/pet`, method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -253,23 +224,20 @@ export class PetApi extends BaseAPI { /** * Updates a pet in the store with form data */ - updatePetWithForm(requestParameters: UpdatePetWithFormRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling updatePetWithForm.'); - } + updatePetWithForm = (requestParameters: UpdatePetWithFormRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'updatePetWithForm'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.name !== undefined) { @@ -281,10 +249,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -292,23 +260,20 @@ export class PetApi extends BaseAPI { /** * uploads an image */ - uploadFile(requestParameters: UploadFileRequest): Observable { - if (requestParameters.petId === null || requestParameters.petId === undefined) { - throw new RequiredError('petId','Required parameter requestParameters.petId was null or undefined when calling uploadFile.'); - } + uploadFile = (requestParameters: UploadFileRequest): Observable => { + throwIfRequired(requestParameters, 'petId', 'uploadFile'); - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - if (this.configuration && this.configuration.accessToken) { + const headers: HttpHeaders = { // oauth required - if (typeof this.configuration.accessToken === 'function') { - headerParameters["Authorization"] = this.configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]); - } else { - headerParameters["Authorization"] = this.configuration.accessToken; - } - } + ...(this.configuration.accessToken && { + Authorization: this.configuration.accessToken && (typeof this.configuration.accessToken === 'function' + ? this.configuration.accessToken('petstore_auth', ['write:pets', 'read:pets']) + : this.configuration.accessToken) + }), + }; + + const query: HttpQuery = { + }; const formData = new FormData(); if (requestParameters.additionalMetadata !== undefined) { @@ -320,10 +285,10 @@ export class PetApi extends BaseAPI { } return this.request({ - path: `/pet/{petId}/uploadImage`.replace(`{${"petId"}}`, encodeURIComponent(String(requestParameters.petId))), + path: `/pet/{petId}/uploadImage`.replace(`{petId}`, encodeURIComponent(String(requestParameters.petId))), method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: formData, }); } @@ -331,9 +296,9 @@ export class PetApi extends BaseAPI { } /** - * @export - * @enum {string} - */ + * @export + * @enum {string} + */ export enum FindPetsByStatusStatusEnum { Available = 'available', Pending = 'pending', diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts index c0755e5c98f..d7350a81516 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/StoreApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { Order, } from '../models'; @@ -38,20 +38,20 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Delete purchase order by ID */ - deleteOrder(requestParameters: DeleteOrderRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling deleteOrder.'); - } + deleteOrder = (requestParameters: DeleteOrderRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'deleteOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -59,20 +59,20 @@ export class StoreApi extends BaseAPI { * Returns a map of status codes to quantities * Returns pet inventories by status */ - getInventory(): Observable<{ [key: string]: number; }> { - const queryParameters: HttpQuery = {}; + getInventory = (): Observable<{ [key: string]: number; }> => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + ...(this.configuration.apiKey && { 'api_key': this.configuration.apiKey('api_key') }), // api_key authentication + }; - if (this.configuration && this.configuration.apiKey) { - headerParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication - } + const query: HttpQuery = { + }; return this.request<{ [key: string]: number; }>({ path: `/store/inventory`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -80,42 +80,41 @@ export class StoreApi extends BaseAPI { * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * Find purchase order by ID */ - getOrderById(requestParameters: GetOrderByIdRequest): Observable { - if (requestParameters.orderId === null || requestParameters.orderId === undefined) { - throw new RequiredError('orderId','Required parameter requestParameters.orderId was null or undefined when calling getOrderById.'); - } + getOrderById = (requestParameters: GetOrderByIdRequest): Observable => { + throwIfRequired(requestParameters, 'orderId', 'getOrderById'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/store/order/{orderId}`.replace(`{${"orderId"}}`, encodeURIComponent(String(requestParameters.orderId))), + path: `/store/order/{orderId}`.replace(`{orderId}`, encodeURIComponent(String(requestParameters.orderId))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Place an order for a pet */ - placeOrder(requestParameters: PlaceOrderRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling placeOrder.'); - } + placeOrder = (requestParameters: PlaceOrderRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'placeOrder'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/store/order`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts index dee6c06cbea..8b994caf6c8 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/apis/UserApi.ts @@ -12,7 +12,7 @@ */ import { Observable } from 'rxjs'; -import { BaseAPI, RequiredError, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; +import { BaseAPI, throwIfRequired, HttpHeaders, HttpQuery, COLLECTION_FORMATS } from '../runtime'; import { User, } from '../models'; @@ -56,22 +56,21 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Create user */ - createUser(requestParameters: CreateUserRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUser.'); - } + createUser = (requestParameters: CreateUserRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -79,22 +78,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithArrayInput(requestParameters: CreateUsersWithArrayInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithArrayInput.'); - } + createUsersWithArrayInput = (requestParameters: CreateUsersWithArrayInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithArrayInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithArray`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -102,22 +100,21 @@ export class UserApi extends BaseAPI { /** * Creates list of users with given input array */ - createUsersWithListInput(requestParameters: CreateUsersWithListInputRequest): Observable { - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling createUsersWithListInput.'); - } + createUsersWithListInput = (requestParameters: CreateUsersWithListInputRequest): Observable => { + throwIfRequired(requestParameters, 'body', 'createUsersWithListInput'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ path: `/user/createWithList`, method: 'POST', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } @@ -126,88 +123,82 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Delete user */ - deleteUser(requestParameters: DeleteUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling deleteUser.'); - } + deleteUser = (requestParameters: DeleteUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'deleteUser'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'DELETE', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Get user by user name */ - getUserByName(requestParameters: GetUserByNameRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling getUserByName.'); - } + getUserByName = (requestParameters: GetUserByNameRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'getUserByName'); - const queryParameters: HttpQuery = {}; + const headers: HttpHeaders = { + }; - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs user into the system */ - loginUser(requestParameters: LoginUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling loginUser.'); - } + loginUser = (requestParameters: LoginUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'loginUser'); + throwIfRequired(requestParameters, 'password', 'loginUser'); - if (requestParameters.password === null || requestParameters.password === undefined) { - throw new RequiredError('password','Required parameter requestParameters.password was null or undefined when calling loginUser.'); - } + const headers: HttpHeaders = { + }; - const queryParameters: HttpQuery = {}; - - if (requestParameters.username !== undefined && requestParameters.username !== null) { - queryParameters['username'] = requestParameters.username; - } - - if (requestParameters.password !== undefined && requestParameters.password !== null) { - queryParameters['password'] = requestParameters.password; - } - - const headerParameters: HttpHeaders = {}; + const query: HttpQuery = { + ...(requestParameters.username && { 'username': requestParameters.username }), + ...(requestParameters.password && { 'password': requestParameters.password }), + }; return this.request({ path: `/user/login`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } /** * Logs out current logged in user session */ - logoutUser(): Observable { - const queryParameters: HttpQuery = {}; + logoutUser = (): Observable => { - const headerParameters: HttpHeaders = {}; + const headers: HttpHeaders = { + }; + + const query: HttpQuery = { + }; return this.request({ path: `/user/logout`, method: 'GET', - headers: headerParameters, - query: queryParameters, + headers, + query, }); } @@ -215,26 +206,22 @@ export class UserApi extends BaseAPI { * This can only be done by the logged in user. * Updated user */ - updateUser(requestParameters: UpdateUserRequest): Observable { - if (requestParameters.username === null || requestParameters.username === undefined) { - throw new RequiredError('username','Required parameter requestParameters.username was null or undefined when calling updateUser.'); - } + updateUser = (requestParameters: UpdateUserRequest): Observable => { + throwIfRequired(requestParameters, 'username', 'updateUser'); + throwIfRequired(requestParameters, 'body', 'updateUser'); - if (requestParameters.body === null || requestParameters.body === undefined) { - throw new RequiredError('body','Required parameter requestParameters.body was null or undefined when calling updateUser.'); - } + const headers: HttpHeaders = { + 'Content-Type': 'application/json', + }; - const queryParameters: HttpQuery = {}; - - const headerParameters: HttpHeaders = {}; - - headerParameters['Content-Type'] = 'application/json'; + const query: HttpQuery = { + }; return this.request({ - path: `/user/{username}`.replace(`{${"username"}}`, encodeURIComponent(String(requestParameters.username))), + path: `/user/{username}`.replace(`{username}`, encodeURIComponent(String(requestParameters.username))), method: 'PUT', - headers: headerParameters, - query: queryParameters, + headers, + query, body: requestParameters.body, }); } diff --git a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts index e28e284bf19..1d160d5d379 100644 --- a/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts +++ b/samples/client/petstore/typescript-rxjs/builds/with-npm-version/runtime.ts @@ -66,30 +66,26 @@ export class Configuration { * This is the base class for all generated API classes. */ export class BaseAPI { - private middleware: Middleware[]; + private middleware: Middleware[] = []; constructor(protected configuration = new Configuration()) { this.middleware = configuration.middleware; } - withMiddleware(this: T, ...middlewares: Middleware[]) { + withMiddleware = (middlewares: Middleware[]) => { const next = this.clone(); - next.middleware = next.middleware.concat(...middlewares); + next.middleware = next.middleware.concat(middlewares); return next; } - withPreMiddleware(this: T, ...preMiddlewares: Array) { - const middlewares = preMiddlewares.map((pre) => ({ pre })); - return this.withMiddleware(...middlewares); - } + withPreMiddleware = (preMiddlewares: Array) => + this.withMiddleware(preMiddlewares.map((pre) => ({ pre }))); - withPostMiddleware(this: T, ...postMiddlewares: Array) { - const middlewares = postMiddlewares.map((post) => ({ post })); - return this.withMiddleware(...middlewares); - } + withPostMiddleware = (postMiddlewares: Array) => + this.withMiddleware(postMiddlewares.map((post) => ({ post }))); - protected request(context: RequestOpts): Observable { - return this.rxjsRequest(this.createRequestArgs(context)).pipe( + protected request = (context: RequestOpts): Observable => + this.rxjsRequest(this.createRequestArgs(context)).pipe( map((res) => { if (res.status >= 200 && res.status < 300) { return res.response as T; @@ -97,15 +93,14 @@ export class BaseAPI { throw res; }) ); - } - private createRequestArgs(context: RequestOpts): RequestArgs { + private createRequestArgs = (context: RequestOpts): RequestArgs => { let url = this.configuration.basePath + context.path; if (context.query !== undefined && Object.keys(context.query).length !== 0) { - // only add the querystring to the URL if there are query parameters. + // only add the queryString to the URL if there are query parameters. // this is done to avoid urls ending with a '?' character which buggy webservers // do not handle correctly sometimes. - url += '?' + querystring(context.query); + url += '?' + queryString(context.query); } const body = context.body instanceof FormData ? context.body : JSON.stringify(context.body); const options = { @@ -116,9 +111,9 @@ export class BaseAPI { return { url, options }; } - private rxjsRequest(params: RequestContext): Observable { - const preMiddlewares = this.middleware && this.middleware.filter((item) => item.pre); - const postMiddlewares = this.middleware && this.middleware.filter((item) => item.post); + private rxjsRequest = (params: RequestContext): Observable => { + const preMiddlewares = this.middleware.filter((item) => item.pre); + const postMiddlewares = this.middleware.filter((item) => item.post); return of(params).pipe( map((args) => { @@ -144,19 +139,13 @@ export class BaseAPI { * Create a shallow clone of `this` by constructing a new instance * and then shallow cloning data members. */ - private clone(this: T): T { - const constructor = this.constructor as any; - const next = new constructor(this.configuration); - next.middleware = this.middleware.slice(); - return next; - } + private clone = (): T => + Object.assign(Object.create(Object.getPrototypeOf(this)), this) } +// export for not being a breaking change export class RequiredError extends Error { name: 'RequiredError' = 'RequiredError'; - constructor(public field: string, msg?: string) { - super(msg); - } } export const COLLECTION_FORMATS = { @@ -186,17 +175,24 @@ export interface RequestOpts { body?: HttpBody; } -export function querystring(params: HttpQuery): string { - return Object.keys(params) - .map((key) => { - const value = params[key]; - if (value instanceof Array) { - return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) - .join('&'); - } - return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; - }) - .join('&'); +const queryString = (params: HttpQuery): string => Object.keys(params) + .map((key) => { + const value = params[key]; + if (value instanceof Array) { + return value.map((val) => `${encodeURIComponent(key)}=${encodeURIComponent(String(val))}`) + .join('&'); + } + return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`; + }) + .join('&'); + +// alias fallback for not being a breaking change +export const querystring = queryString; + +export const throwIfRequired = (params: {[key: string]: any}, key: string, nickname: string) => { + if (!params || params[key] === null || params[key] === undefined) { + throw new RequiredError(`Required parameter ${key} was null or undefined when calling ${nickname}.`); + } } export interface RequestContext extends RequestArgs {} diff --git a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION index afa63656064..d96260ba335 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION +++ b/samples/openapi3/client/petstore/go/go-petstore/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/go/go-petstore/README.md b/samples/openapi3/client/petstore/go/go-petstore/README.md index 4a51fe4074f..82f28d6e265 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/README.md +++ b/samples/openapi3/client/petstore/go/go-petstore/README.md @@ -12,7 +12,8 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat ## Installation Install the following dependencies: -``` + +```shell go get github.com/stretchr/testify/assert go get golang.org/x/oauth2 go get golang.org/x/net/context @@ -20,6 +21,7 @@ go get github.com/antihax/optional ``` Put the package under your project folder and add the following in import: + ```golang import "./petstore" ``` @@ -79,10 +81,12 @@ Class | Method | HTTP request | Description - [ArrayTest](docs/ArrayTest.md) - [Capitalization](docs/Capitalization.md) - [Cat](docs/Cat.md) + - [CatAllOf](docs/CatAllOf.md) - [Category](docs/Category.md) - [ClassModel](docs/ClassModel.md) - [Client](docs/Client.md) - [Dog](docs/Dog.md) + - [DogAllOf](docs/DogAllOf.md) - [EnumArrays](docs/EnumArrays.md) - [EnumClass](docs/EnumClass.md) - [EnumTest](docs/EnumTest.md) @@ -104,6 +108,7 @@ Class | Method | HTTP request | Description - [MixedPropertiesAndAdditionalPropertiesClass](docs/MixedPropertiesAndAdditionalPropertiesClass.md) - [Model200Response](docs/Model200Response.md) - [Name](docs/Name.md) + - [NullableClass](docs/NullableClass.md) - [NumberOnly](docs/NumberOnly.md) - [Order](docs/Order.md) - [OuterComposite](docs/OuterComposite.md) @@ -121,51 +126,71 @@ Class | Method | HTTP request | Description ## Documentation For Authorization + + ## api_key -- **Type**: API key + +- **Type**: API key Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. }) r, err := client.Service.Operation(auth, args) ``` + + ## api_key_query -- **Type**: API key + +- **Type**: API key Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{ - Key: "APIKEY", - Prefix: "Bearer", // Omit if not necessary. + Key: "APIKEY", + Prefix: "Bearer", // Omit if not necessary. }) r, err := client.Service.Operation(auth, args) ``` + + ## bearer_test + - **Type**: HTTP basic authentication Example + ```golang auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", + UserName: "username", + Password: "password", }) r, err := client.Service.Operation(auth, args) ``` + + ## http_basic_test + - **Type**: HTTP basic authentication Example + ```golang auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{ - UserName: "username", - Password: "password", + UserName: "username", + Password: "password", }) r, err := client.Service.Operation(auth, args) ``` + + ## petstore_auth + + - **Type**: OAuth - **Flow**: implicit - **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog @@ -174,12 +199,14 @@ r, err := client.Service.Operation(auth, args) - **read:pets**: read your pets Example + ```golang auth := context.WithValue(context.Background(), sw.ContextAccessToken, "ACCESSTOKENSTRING") r, err := client.Service.Operation(auth, args) ``` Or via OAuth2 module to automatically refresh tokens and perform user authentication. + ```golang import "golang.org/x/oauth2" @@ -190,6 +217,7 @@ auth := context.WithValue(oauth2.NoContext, sw.ContextOAuth2, tokenSource) r, err := client.Service.Operation(auth, args) ``` + ## Author diff --git a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml index 2cd94b385f3..260820910af 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/openapi3/client/petstore/go/go-petstore/api/openapi.yaml @@ -130,7 +130,8 @@ paths: /pet/findByTags: get: deprecated: true - description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - description: Tags to filter by @@ -350,7 +351,8 @@ paths: - store /store/order/{order_id}: delete: - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted @@ -370,7 +372,8 @@ paths: tags: - store get: - description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions operationId: getOrderById parameters: - description: ID of pet that needs to be fetched @@ -604,7 +607,6 @@ paths: name: required_string_group required: true schema: - format: int32 type: integer style: form - description: Required Boolean in group parameters @@ -630,7 +632,6 @@ paths: name: string_group required: false schema: - format: int32 type: integer style: form - description: Boolean in group parameters @@ -803,7 +804,6 @@ paths: properties: integer: description: None - format: int32 maximum: 100 minimum: 10 type: integer @@ -1045,7 +1045,8 @@ paths: - $another-fake? /fake/body-with-file-schema: put: - description: For this test, the body for this request much reference a schema named `File`. + description: For this test, the body for this request much reference a schema + named `File`. operationId: testBodyWithFileSchema requestBody: content: @@ -1368,7 +1369,6 @@ components: property: type: string 123Number: - format: int32 readOnly: true type: integer required: @@ -1393,17 +1393,11 @@ components: Dog: allOf: - $ref: '#/components/schemas/Animal' - - properties: - breed: - type: string - type: object + - $ref: '#/components/schemas/Dog_allOf' Cat: allOf: - $ref: '#/components/schemas/Animal' - - properties: - declawed: - type: boolean - type: object + - $ref: '#/components/schemas/Cat_allOf' Animal: discriminator: propertyName: className @@ -1423,7 +1417,6 @@ components: format_test: properties: integer: - format: int32 maximum: 100 minimum: 10 type: integer @@ -1478,7 +1471,8 @@ components: pattern: ^\d{10}$ type: string pattern_with_digits_and_delimiter: - description: A string starting with 'image_' (case insensitive) and one to three digits following i.e. Image_01. + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. pattern: /^image_\d{1,3}$/i type: string required: @@ -1625,6 +1619,7 @@ components: indirect_map: additionalProperties: type: boolean + type: object type: object ArrayTest: properties: @@ -1693,7 +1688,6 @@ components: - 0 - 1 - 2 - format: int32 type: integer OuterEnumDefaultValue: default: placed @@ -1708,7 +1702,6 @@ components: - 0 - 1 - 2 - format: int32 type: integer OuterComposite: example: @@ -1734,6 +1727,7 @@ components: StringBooleanMap: additionalProperties: type: boolean + type: object FileSchemaTestClass: example: file: @@ -1766,7 +1760,8 @@ components: xml: name: $special[model.name] HealthCheckResult: - description: Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + description: Just a string to inform instance is up and running. Make it nullable + in hope to get it as pointer in generated model. example: NullableMessage: NullableMessage properties: @@ -1774,6 +1769,64 @@ components: nullable: true type: string type: object + NullableClass: + additionalProperties: + nullable: true + type: object + properties: + integer_prop: + nullable: true + type: integer + number_prop: + nullable: true + type: number + boolean_prop: + nullable: true + type: boolean + string_prop: + nullable: true + type: string + date_prop: + format: date + nullable: true + type: string + datetime_prop: + format: date-time + nullable: true + type: string + array_nullable_prop: + items: + type: object + nullable: true + type: array + array_and_items_nullable_prop: + items: + nullable: true + type: object + nullable: true + type: array + array_items_nullable: + items: + nullable: true + type: object + type: array + object_nullable_prop: + additionalProperties: + type: object + nullable: true + type: object + object_and_items_nullable_prop: + additionalProperties: + nullable: true + type: object + nullable: true + type: object + object_items_nullable: + additionalProperties: + nullable: true + type: object + type: object + type: object inline_response_default: example: string: @@ -1824,7 +1877,6 @@ components: properties: integer: description: None - format: int32 maximum: 100 minimum: 10 type: integer @@ -1917,6 +1969,14 @@ components: required: - requiredFile type: object + Dog_allOf: + properties: + breed: + type: string + Cat_allOf: + properties: + declawed: + type: boolean securitySchemes: petstore_auth: flows: diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go index f74f5bffd55..1c5c50d2e53 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_another_fake.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -33,7 +32,7 @@ To test special tags and operation ID starting with number */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_default.go b/samples/openapi3/client/petstore/go/go-petstore/api_default.go index 78cb5d9ae6e..1642ea1d22c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_default.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_default.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -31,7 +30,7 @@ DefaultApiService */ func (a *DefaultApiService) FooGet(ctx context.Context) (InlineResponseDefault, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go index 94003cdd5aa..6dd6f996d1f 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "github.com/antihax/optional" "os" ) @@ -33,7 +32,7 @@ FakeApiService Health check endpoint */ func (a *FakeApiService) FakeHealthGet(ctx context.Context) (HealthCheckResult, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -126,7 +125,7 @@ type FakeOuterBooleanSerializeOpts struct { func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -224,7 +223,7 @@ type FakeOuterCompositeSerializeOpts struct { func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -326,7 +325,7 @@ type FakeOuterNumberSerializeOpts struct { func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -424,7 +423,7 @@ type FakeOuterStringSerializeOpts struct { func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -515,7 +514,7 @@ For this test, the body for this request much reference a schema named `Fil */ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -583,7 +582,7 @@ FakeApiService */ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -653,7 +652,7 @@ To test \"client\" model */ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -769,7 +768,7 @@ type TestEndpointParametersOpts struct { func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -913,7 +912,7 @@ type TestEnumParametersOpts struct { func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1016,7 +1015,7 @@ type TestGroupParametersOpts struct { func (a *FakeApiService) TestGroupParameters(ctx context.Context, requiredStringGroup int32, requiredBooleanGroup bool, requiredInt64Group int64, localVarOptionals *TestGroupParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1093,7 +1092,7 @@ FakeApiService test inline additionalProperties */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1161,7 +1160,7 @@ FakeApiService test json serialization of form data */ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go index f5448af3597..c58af2fc260 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_fake_classname_tags123.go @@ -14,7 +14,6 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" ) // Linger please @@ -33,7 +32,7 @@ To test class name in snake case */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = http.MethodPatch localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_pet.go b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go index a496a787982..564ca6cf47c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_pet.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_pet.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" "github.com/antihax/optional" "os" ) @@ -34,7 +34,7 @@ PetApiService Add a new pet to the store */ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -108,7 +108,7 @@ type DeletePetOpts struct { func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -179,7 +179,7 @@ Multiple status values can be provided with comma separated strings */ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -267,7 +267,7 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 */ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -355,7 +355,7 @@ Returns a single pet */ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -453,7 +453,7 @@ PetApiService Update an existing pet */ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -529,7 +529,7 @@ type UpdatePetWithFormOpts struct { func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -611,7 +611,7 @@ type UploadFileOpts struct { func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -724,7 +724,7 @@ type UploadFileWithRequiredFileOpts struct { func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_store.go b/samples/openapi3/client/petstore/go/go-petstore/api_store.go index cec38c8c42b..39411cc6f67 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_store.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_store.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -33,7 +33,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -100,7 +100,7 @@ Returns a map of status codes to quantities */ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -199,7 +199,7 @@ For valid response try integer IDs with value <= 5 or > 10. Other val */ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -292,7 +292,7 @@ StoreApiService Place an order for a pet */ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/api_user.go b/samples/openapi3/client/petstore/go/go-petstore/api_user.go index 75eb29fd091..da7b38d1dfa 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/api_user.go +++ b/samples/openapi3/client/petstore/go/go-petstore/api_user.go @@ -14,8 +14,8 @@ import ( "io/ioutil" "net/http" "net/url" - "strings" "fmt" + "strings" ) // Linger please @@ -33,7 +33,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -100,7 +100,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -167,7 +167,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = http.MethodPost localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -235,7 +235,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = http.MethodDelete localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -302,7 +302,7 @@ UserApiService Get user by user name */ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -390,7 +390,7 @@ UserApiService Logs user into the system */ func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -476,7 +476,7 @@ UserApiService Logs out current logged in user session */ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = http.MethodGet localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -543,7 +543,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = http.MethodPut localVarPostBody interface{} localVarFormFileName string localVarFileName string diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index ca4d0d38465..db46607be28 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -232,10 +232,11 @@ func (c *APIClient) prepareRequest( if err != nil { return nil, err } - // Set the Boundary in the Content-Type - headerParams["Content-Type"] = w.FormDataContentType() } + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + // Set Content-Length headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) w.Close() @@ -257,6 +258,16 @@ func (c *APIClient) prepareRequest( return nil, err } + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + // Adding Query Param query := url.Query() for k, v := range queryParams { @@ -287,11 +298,6 @@ func (c *APIClient) prepareRequest( localVarRequest.Header = headers } - // Override request host, if applicable - if c.cfg.Host != "" { - localVarRequest.Host = c.cfg.Host - } - // Add the user agent to the request. localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) @@ -331,6 +337,10 @@ func (c *APIClient) prepareRequest( } func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } if xmlCheck.MatchString(contentType) { if err = xml.Unmarshal(b, v); err != nil { return err @@ -385,7 +395,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e } else if jsonCheck.MatchString(contentType) { err = json.NewEncoder(bodyBuf).Encode(body) } else if xmlCheck.MatchString(contentType) { - xml.NewEncoder(bodyBuf).Encode(body) + err = xml.NewEncoder(bodyBuf).Encode(body) } if err != nil { diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md index 0c8ba7085b3..9668c3d6427 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/AdditionalPropertiesClass.md @@ -1,6 +1,7 @@ # AdditionalPropertiesClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapProperty** | **map[string]string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md index d7113331a60..02d23377da6 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Animal.md @@ -1,6 +1,7 @@ # Animal ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md index 43c63231137..9c6ce64e293 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/AnotherFakeApi.md @@ -7,7 +7,9 @@ Method | HTTP request | Description [**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags -# **Call123TestSpecialTags** + +## Call123TestSpecialTags + > Client Call123TestSpecialTags(ctx, client) To test special tags @@ -15,10 +17,11 @@ To test special tags and operation ID starting with number ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**client** | [**Client**](Client.md)| client model | ### Return type @@ -30,8 +33,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md index f9b16338ecd..41d28fb578c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ApiResponse.md @@ -1,6 +1,7 @@ # ApiResponse ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Code** | **int32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md index a53147b6270..555213013b2 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfArrayOfNumberOnly.md @@ -1,6 +1,7 @@ # ArrayOfArrayOfNumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayArrayNumber** | [**[][]float32**](array.md) | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md index 19031e76d20..56618756dd7 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayOfNumberOnly.md @@ -1,6 +1,7 @@ # ArrayOfNumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayNumber** | **[]float32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md index a46d1acf665..0da0bc52d2d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ArrayTest.md @@ -1,6 +1,7 @@ # ArrayTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ArrayOfString** | **[]string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md index ac65ee37dba..426b8eabd9b 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Capitalization.md @@ -1,6 +1,7 @@ # Capitalization ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SmallCamel** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md index b51d5fd2b95..1ef1f095e94 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Cat.md @@ -1,6 +1,7 @@ # Cat ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/CatAllOf.md b/samples/openapi3/client/petstore/go/go-petstore/docs/CatAllOf.md new file mode 100644 index 00000000000..c978cee0417 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/CatAllOf.md @@ -0,0 +1,11 @@ +# CatAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Declawed** | **bool** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md index 1440215d225..01e8344bd06 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Category.md @@ -1,6 +1,7 @@ # Category ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md index 8d7a7284393..0b925cebb1f 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ClassModel.md @@ -1,6 +1,7 @@ # ClassModel ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Class** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md index fdf5fd9a69d..551da852eec 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Client.md @@ -1,6 +1,7 @@ # Client ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Client** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md index 5d1fe96684d..4fd0ab98720 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/DefaultApi.md @@ -7,11 +7,14 @@ Method | HTTP request | Description [**FooGet**](DefaultApi.md#FooGet) | **Get** /foo | -# **FooGet** + +## FooGet + > InlineResponseDefault FooGet(ctx, ) ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -24,8 +27,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md index 13c0aa28e6b..ff35dd5cdca 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Dog.md @@ -1,6 +1,7 @@ # Dog ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **ClassName** | **string** | | diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/DogAllOf.md b/samples/openapi3/client/petstore/go/go-petstore/docs/DogAllOf.md new file mode 100644 index 00000000000..b87153e9265 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/DogAllOf.md @@ -0,0 +1,11 @@ +# DogAllOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Breed** | **string** | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md index 9eca8b29032..3021f881830 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumArrays.md @@ -1,6 +1,7 @@ # EnumArrays ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustSymbol** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md index 67f017becd0..c6932388c06 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumClass.md @@ -1,6 +1,7 @@ # EnumClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md index 26c48e0c126..1fe92c432dc 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/EnumTest.md @@ -1,6 +1,7 @@ # EnumTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **EnumString** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md index 62bb01be5c8..5695233a26c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeApi.md @@ -19,11 +19,14 @@ Method | HTTP request | Description [**TestJsonFormData**](FakeApi.md#TestJsonFormData) | **Get** /fake/jsonFormData | test json serialization of form data -# **FakeHealthGet** + +## FakeHealthGet + > HealthCheckResult FakeHealthGet(ctx, ) Health check endpoint ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -36,12 +39,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterBooleanSerialize -# **FakeOuterBooleanSerialize** > bool FakeOuterBooleanSerialize(ctx, optional) @@ -49,14 +56,17 @@ Test serialization of outer boolean types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterBooleanSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterBooleanSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.Bool**| Input boolean as post body | @@ -71,12 +81,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: */* +- **Content-Type**: application/json +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterCompositeSerialize -# **FakeOuterCompositeSerialize** > OuterComposite FakeOuterCompositeSerialize(ctx, optional) @@ -84,14 +98,17 @@ Test serialization of object with outer number type ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterCompositeSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterCompositeSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **outerComposite** | [**optional.Interface of OuterComposite**](OuterComposite.md)| Input composite as post body | @@ -106,12 +123,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: */* +- **Content-Type**: application/json +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterNumberSerialize -# **FakeOuterNumberSerialize** > float32 FakeOuterNumberSerialize(ctx, optional) @@ -119,14 +140,17 @@ Test serialization of outer number types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterNumberSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterNumberSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.Float32**| Input number as post body | @@ -141,12 +165,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: */* +- **Content-Type**: application/json +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FakeOuterStringSerialize -# **FakeOuterStringSerialize** > string FakeOuterStringSerialize(ctx, optional) @@ -154,14 +182,17 @@ Test serialization of outer string types ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***FakeOuterStringSerializeOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a FakeOuterStringSerializeOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | **optional.String**| Input string as post body | @@ -176,12 +207,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: */* +- **Content-Type**: application/json +- **Accept**: */* -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestBodyWithFileSchema -# **TestBodyWithFileSchema** > TestBodyWithFileSchema(ctx, fileSchemaTestClass) @@ -189,10 +224,11 @@ For this test, the body for this request much reference a schema named `File`. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | ### Return type @@ -204,22 +240,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestBodyWithQueryParams -# **TestBodyWithQueryParams** > TestBodyWithQueryParams(ctx, query, user) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **query** | **string**| | - **user** | [**User**](User.md)| | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**query** | **string**| | +**user** | [**User**](User.md)| | ### Return type @@ -231,12 +272,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestClientModel -# **TestClientModel** > Client TestClientModel(ctx, client) To test \"client\" model @@ -244,10 +289,11 @@ To test \"client\" model ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**client** | [**Client**](Client.md)| client model | ### Return type @@ -259,12 +305,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestEndpointParameters -# **TestEndpointParameters** > TestEndpointParameters(ctx, number, double, patternWithoutDelimiter, byte_, optional) Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -272,18 +322,21 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **number** | **float32**| None | - **double** | **float64**| None | - **patternWithoutDelimiter** | **string**| None | - **byte_** | **string**| None | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**number** | **float32**| None | +**double** | **float64**| None | +**patternWithoutDelimiter** | **string**| None | +**byte_** | **string**| None | **optional** | ***TestEndpointParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestEndpointParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -311,12 +364,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestEnumParameters -# **TestEnumParameters** > TestEnumParameters(ctx, optional) To test enum parameters @@ -324,14 +381,17 @@ To test enum parameters ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. **optional** | ***TestEnumParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestEnumParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **enumHeaderStringArray** | [**optional.Interface of []string**](string.md)| Header parameter enum test (string array) | @@ -353,12 +413,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestGroupParameters -# **TestGroupParameters** > TestGroupParameters(ctx, requiredStringGroup, requiredBooleanGroup, requiredInt64Group, optional) Fake endpoint to test group parameters (optional) @@ -366,17 +430,20 @@ Fake endpoint to test group parameters (optional) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **requiredStringGroup** | **int32**| Required String in group parameters | - **requiredBooleanGroup** | **bool**| Required Boolean in group parameters | - **requiredInt64Group** | **int64**| Required Integer in group parameters | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**requiredStringGroup** | **int32**| Required String in group parameters | +**requiredBooleanGroup** | **bool**| Required Boolean in group parameters | +**requiredInt64Group** | **int64**| Required Integer in group parameters | **optional** | ***TestGroupParametersOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a TestGroupParametersOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -396,21 +463,26 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestInlineAdditionalProperties -# **TestInlineAdditionalProperties** > TestInlineAdditionalProperties(ctx, requestBody) test inline additionalProperties ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **requestBody** | [**map[string]string**](string.md)| request body | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**requestBody** | [**map[string]string**](string.md)| request body | ### Return type @@ -422,22 +494,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## TestJsonFormData -# **TestJsonFormData** > TestJsonFormData(ctx, param, param2) test json serialization of form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **param** | **string**| field1 | - **param2** | **string**| field2 | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**param** | **string**| field1 | +**param2** | **string**| field2 | ### Return type @@ -449,8 +526,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md index db334ab5689..5bf7b3bcc99 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FakeClassnameTags123Api.md @@ -7,7 +7,9 @@ Method | HTTP request | Description [**TestClassname**](FakeClassnameTags123Api.md#TestClassname) | **Patch** /fake_classname_test | To test class name in snake case -# **TestClassname** + +## TestClassname + > Client TestClassname(ctx, client) To test class name in snake case @@ -15,10 +17,11 @@ To test class name in snake case ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **client** | [**Client**](Client.md)| client model | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**client** | [**Client**](Client.md)| client model | ### Return type @@ -30,8 +33,10 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/json +- **Content-Type**: application/json +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/File.md b/samples/openapi3/client/petstore/go/go-petstore/docs/File.md index e7f7d80e05d..a113b0312cd 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/File.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/File.md @@ -1,6 +1,7 @@ # File ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SourceURI** | **string** | Test capitalization | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md index 69cbfa2c189..ae51414dd6c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FileSchemaTestClass.md @@ -1,6 +1,7 @@ # FileSchemaTestClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **File** | [**File**](File.md) | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md index 4900535886f..a5f66bcf525 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Foo.md @@ -1,6 +1,7 @@ # Foo ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Bar** | **string** | | [optional] [default to bar] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md index 8801f1d5700..0bc27ab1c4b 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/FormatTest.md @@ -1,6 +1,7 @@ # FormatTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Integer** | **int32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md index c259e8b325a..9e2f4957359 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/HasOnlyReadOnly.md @@ -1,6 +1,7 @@ # HasOnlyReadOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Bar** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md b/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md index fa2d93d82aa..5c8c5861027 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/HealthCheckResult.md @@ -1,6 +1,7 @@ # HealthCheckResult ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **NullableMessage** | Pointer to **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md index ba0eb8201e2..3065b5f2433 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject.md @@ -1,6 +1,7 @@ # InlineObject ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **string** | Updated name of the pet | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md index 0330fdd8ff7..0e4f031ae78 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject1.md @@ -1,6 +1,7 @@ # InlineObject1 ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AdditionalMetadata** | **string** | Additional data to pass to server | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md index dca7f2953e4..c7f889b63b5 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject2.md @@ -1,6 +1,7 @@ # InlineObject2 ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **EnumFormStringArray** | **[]string** | Form parameter enum test (string array) | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md index 398fa834485..8c5249fca4d 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject3.md @@ -1,6 +1,7 @@ # InlineObject3 ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Integer** | **int32** | None | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md index ff4b519d951..988e4881314 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject4.md @@ -1,6 +1,7 @@ # InlineObject4 ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Param** | **string** | field1 | diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md index c5d977bebe6..bcd135b5a97 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineObject5.md @@ -1,6 +1,7 @@ # InlineObject5 ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **AdditionalMetadata** | **string** | Additional data to pass to server | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md index e437c153a5f..071a391fbf3 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/InlineResponseDefault.md @@ -1,6 +1,7 @@ # InlineResponseDefault ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **String** | [**Foo**](Foo.md) | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/List.md b/samples/openapi3/client/petstore/go/go-petstore/docs/List.md index 3255fa27868..bba2e529906 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/List.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/List.md @@ -1,6 +1,7 @@ # List ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Var123List** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md b/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md index 49381ec4b85..6645e044658 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/MapTest.md @@ -1,6 +1,7 @@ # MapTest ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md index 0e5f61f6273..a2ce1068b27 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -1,6 +1,7 @@ # MixedPropertiesAndAdditionalPropertiesClass ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Uuid** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md index c5abac20d86..27b93bd1549 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Model200Response.md @@ -1,6 +1,7 @@ # Model200Response ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **int32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md index fccddf63899..453e54d9851 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Name.md @@ -1,6 +1,7 @@ # Name ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Name** | **int32** | | diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/NullableClass.md b/samples/openapi3/client/petstore/go/go-petstore/docs/NullableClass.md new file mode 100644 index 00000000000..7c70bd76808 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/NullableClass.md @@ -0,0 +1,22 @@ +# NullableClass + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**IntegerProp** | Pointer to **int32** | | [optional] +**NumberProp** | Pointer to **float32** | | [optional] +**BooleanProp** | Pointer to **bool** | | [optional] +**StringProp** | Pointer to **string** | | [optional] +**DateProp** | Pointer to **string** | | [optional] +**DatetimeProp** | Pointer to [**time.Time**](time.Time.md) | | [optional] +**ArrayNullableProp** | Pointer to [**[]map[string]interface{}**](map[string]interface{}.md) | | [optional] +**ArrayAndItemsNullableProp** | Pointer to [**[]map[string]interface{}**](map[string]interface{}.md) | | [optional] +**ArrayItemsNullable** | [**[]map[string]interface{}**](map[string]interface{}.md) | | [optional] +**ObjectNullableProp** | Pointer to [**map[string]map[string]interface{}**](map[string]interface{}.md) | | [optional] +**ObjectAndItemsNullableProp** | Pointer to [**map[string]map[string]interface{}**](map[string]interface{}.md) | | [optional] +**ObjectItemsNullable** | [**map[string]map[string]interface{}**](map[string]interface{}.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md b/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md index 4d2ea1b0413..604cf37eede 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/NumberOnly.md @@ -1,6 +1,7 @@ # NumberOnly ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **JustNumber** | **float32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md index befa9151a18..eeef0971005 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Order.md @@ -1,6 +1,7 @@ # Order ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md index 30732cf10bf..df9bce1bd90 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterComposite.md @@ -1,6 +1,7 @@ # OuterComposite ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MyNumber** | **float32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md index 06d413b0168..c97466159c5 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnum.md @@ -1,6 +1,7 @@ # OuterEnum ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md index 1487a710393..823808a3d76 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumDefaultValue.md @@ -1,6 +1,7 @@ # OuterEnumDefaultValue ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md index 8be15eee6a2..b48e6b759a7 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumInteger.md @@ -1,6 +1,7 @@ # OuterEnumInteger ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md index 27d962f106e..cdb350fc185 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/OuterEnumIntegerDefaultValue.md @@ -1,6 +1,7 @@ # OuterEnumIntegerDefaultValue ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md index 049c82eb5a0..c48104c6397 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Pet.md @@ -1,6 +1,7 @@ # Pet ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md index 481ce5e80e5..c4f37589f0c 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/PetApi.md @@ -15,16 +15,19 @@ Method | HTTP request | Description [**UploadFileWithRequiredFile**](PetApi.md#UploadFileWithRequiredFile) | **Post** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) -# **AddPet** + +## AddPet + > AddPet(ctx, pet) Add a new pet to the store ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -36,26 +39,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeletePet -# **DeletePet** > DeletePet(ctx, petId, optional) Deletes a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| Pet id to delete | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| Pet id to delete | **optional** | ***DeletePetOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a DeletePetOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -71,12 +81,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByStatus -# **FindPetsByStatus** > []Pet FindPetsByStatus(ctx, status) Finds Pets by status @@ -84,10 +98,11 @@ Multiple status values can be provided with comma separated strings ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **status** | [**[]string**](string.md)| Status values that need to be considered for filter | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**status** | [**[]string**](string.md)| Status values that need to be considered for filter | ### Return type @@ -99,12 +114,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## FindPetsByTags -# **FindPetsByTags** > []Pet FindPetsByTags(ctx, tags) Finds Pets by tags @@ -112,10 +131,11 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **tags** | [**[]string**](string.md)| Tags to filter by | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**tags** | [**[]string**](string.md)| Tags to filter by | ### Return type @@ -127,12 +147,16 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetPetById -# **GetPetById** > Pet GetPetById(ctx, petId) Find pet by ID @@ -140,10 +164,11 @@ Returns a single pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to return | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to return | ### Return type @@ -155,21 +180,26 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePet -# **UpdatePet** > UpdatePet(ctx, pet) Update an existing pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -181,26 +211,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/json, application/xml - - **Accept**: Not defined +- **Content-Type**: application/json, application/xml +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdatePetWithForm -# **UpdatePetWithForm** > UpdatePetWithForm(ctx, petId, optional) Updates a pet in the store with form data ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet that needs to be updated | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet that needs to be updated | **optional** | ***UpdatePetWithFormOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UpdatePetWithFormOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -217,26 +254,33 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: Not defined +- **Content-Type**: application/x-www-form-urlencoded +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadFile -# **UploadFile** > ApiResponse UploadFile(ctx, petId, optional) uploads an image ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to update | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to update | **optional** | ***UploadFileOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UploadFileOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -253,27 +297,34 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UploadFileWithRequiredFile -# **UploadFileWithRequiredFile** > ApiResponse UploadFileWithRequiredFile(ctx, petId, requiredFile, optional) uploads an image (required) ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **petId** | **int64**| ID of pet to update | - **requiredFile** | ***os.File*****os.File**| file to upload | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**petId** | **int64**| ID of pet to update | +**requiredFile** | ***os.File*****os.File**| file to upload | **optional** | ***UploadFileWithRequiredFileOpts** | optional parameters | nil if no parameters ### Optional Parameters + Optional parameters are passed through a pointer to a UploadFileWithRequiredFileOpts struct + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- @@ -290,8 +341,10 @@ Name | Type | Description | Notes ### HTTP request headers - - **Content-Type**: multipart/form-data - - **Accept**: application/json +- **Content-Type**: multipart/form-data +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md b/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md index b3546db3cc8..3fee799f295 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/ReadOnlyFirst.md @@ -1,6 +1,7 @@ # ReadOnlyFirst ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Bar** | **string** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md index bcf50e4e5cd..11be0b27c50 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Return.md @@ -1,6 +1,7 @@ # Return ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Return** | **int32** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md b/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md index 7b2dfb654c0..96d7a28a409 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/SpecialModelName.md @@ -1,6 +1,7 @@ # SpecialModelName ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **SpecialPropertyName** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md index fb9743b96d0..c7f9bbcee08 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/StoreApi.md @@ -10,7 +10,9 @@ Method | HTTP request | Description [**PlaceOrder**](StoreApi.md#PlaceOrder) | **Post** /store/order | Place an order for a pet -# **DeleteOrder** + +## DeleteOrder + > DeleteOrder(ctx, orderId) Delete purchase order by ID @@ -18,10 +20,11 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or non ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **orderId** | **string**| ID of the order that needs to be deleted | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **string**| ID of the order that needs to be deleted | ### Return type @@ -33,18 +36,23 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetInventory -# **GetInventory** > map[string]int32 GetInventory(ctx, ) Returns pet inventories by status Returns a map of status codes to quantities ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -57,12 +65,16 @@ This endpoint does not need any parameter. ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/json +- **Content-Type**: Not defined +- **Accept**: application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetOrderById -# **GetOrderById** > Order GetOrderById(ctx, orderId) Find purchase order by ID @@ -70,10 +82,11 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **orderId** | **int64**| ID of pet that needs to be fetched | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**orderId** | **int64**| ID of pet that needs to be fetched | ### Return type @@ -85,21 +98,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## PlaceOrder -# **PlaceOrder** > Order PlaceOrder(ctx, order) Place an order for a pet ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **order** | [**Order**](Order.md)| order placed for purchasing the pet | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -111,8 +129,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: application/xml, application/json +- **Content-Type**: application/json +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md b/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md index acacb4f54a7..d6b3cc117b5 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/Tag.md @@ -1,6 +1,7 @@ # Tag ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/User.md b/samples/openapi3/client/petstore/go/go-petstore/docs/User.md index 87e1456c8a8..7675d7ff701 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/User.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/User.md @@ -1,6 +1,7 @@ # User ## Properties + Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **Id** | **int64** | | [optional] diff --git a/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md index 3784b31187d..6c443592e53 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md +++ b/samples/openapi3/client/petstore/go/go-petstore/docs/UserApi.md @@ -14,7 +14,9 @@ Method | HTTP request | Description [**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user -# **CreateUser** + +## CreateUser + > CreateUser(ctx, user) Create user @@ -22,10 +24,11 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**User**](User.md)| Created user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**user** | [**User**](User.md)| Created user object | ### Return type @@ -37,21 +40,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithArrayInput -# **CreateUsersWithArrayInput** > CreateUsersWithArrayInput(ctx, user) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**[]User**](array.md)| List of user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**user** | [**[]User**](User.md)| List of user object | ### Return type @@ -63,21 +71,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## CreateUsersWithListInput -# **CreateUsersWithListInput** > CreateUsersWithListInput(ctx, user) Creates list of users with given input array ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **user** | [**[]User**](array.md)| List of user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**user** | [**[]User**](User.md)| List of user object | ### Return type @@ -89,12 +102,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## DeleteUser -# **DeleteUser** > DeleteUser(ctx, username) Delete user @@ -102,10 +119,11 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The name that needs to be deleted | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be deleted | ### Return type @@ -117,21 +135,26 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## GetUserByName -# **GetUserByName** > User GetUserByName(ctx, username) Get user by user name ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The name that needs to be fetched. Use user1 for testing. | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The name that needs to be fetched. Use user1 for testing. | ### Return type @@ -143,22 +166,27 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LoginUser -# **LoginUser** > string LoginUser(ctx, username, password) Logs user into the system ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| The user name for login | - **password** | **string**| The password for login in clear text | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| The user name for login | +**password** | **string**| The password for login in clear text | ### Return type @@ -170,16 +198,21 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json +- **Content-Type**: Not defined +- **Accept**: application/xml, application/json -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## LogoutUser -# **LogoutUser** > LogoutUser(ctx, ) Logs out current logged in user session ### Required Parameters + This endpoint does not need any parameter. ### Return type @@ -192,12 +225,16 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: Not defined +- **Content-Type**: Not defined +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) + + +## UpdateUser -# **UpdateUser** > UpdateUser(ctx, username, user) Updated user @@ -205,11 +242,12 @@ This can only be done by the logged in user. ### Required Parameters + Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. - **username** | **string**| name that need to be deleted | - **user** | [**User**](User.md)| Updated user object | +**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc. +**username** | **string**| name that need to be deleted | +**user** | [**User**](User.md)| Updated user object | ### Return type @@ -221,8 +259,10 @@ No authorization required ### HTTP request headers - - **Content-Type**: application/json - - **Accept**: Not defined +- **Content-Type**: application/json +- **Accept**: Not defined -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../README.md#documentation-for-models) +[[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_cat_all_of.go b/samples/openapi3/client/petstore/go/go-petstore/model_cat_all_of.go new file mode 100644 index 00000000000..3c1d802bd41 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_cat_all_of.go @@ -0,0 +1,14 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type CatAllOf struct { + Declawed bool `json:"declawed,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_dog_all_of.go b/samples/openapi3/client/petstore/go/go-petstore/model_dog_all_of.go new file mode 100644 index 00000000000..a0db0aba4b5 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_dog_all_of.go @@ -0,0 +1,14 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore + +type DogAllOf struct { + Breed string `json:"breed,omitempty"` +} diff --git a/samples/openapi3/client/petstore/go/go-petstore/model_nullable_class.go b/samples/openapi3/client/petstore/go/go-petstore/model_nullable_class.go new file mode 100644 index 00000000000..b0c0b536e06 --- /dev/null +++ b/samples/openapi3/client/petstore/go/go-petstore/model_nullable_class.go @@ -0,0 +1,28 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstore +import ( + "time" +) + +type NullableClass struct { + IntegerProp *int32 `json:"integer_prop,omitempty"` + NumberProp *float32 `json:"number_prop,omitempty"` + BooleanProp *bool `json:"boolean_prop,omitempty"` + StringProp *string `json:"string_prop,omitempty"` + DateProp *string `json:"date_prop,omitempty"` + DatetimeProp *time.Time `json:"datetime_prop,omitempty"` + ArrayNullableProp *[]map[string]interface{} `json:"array_nullable_prop,omitempty"` + ArrayAndItemsNullableProp *[]map[string]interface{} `json:"array_and_items_nullable_prop,omitempty"` + ArrayItemsNullable []map[string]interface{} `json:"array_items_nullable,omitempty"` + ObjectNullableProp *map[string]map[string]interface{} `json:"object_nullable_prop,omitempty"` + ObjectAndItemsNullableProp *map[string]map[string]interface{} `json:"object_and_items_nullable_prop,omitempty"` + ObjectItemsNullable map[string]map[string]interface{} `json:"object_items_nullable,omitempty"` +} diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md index 74b4b6122ee..0784a164518 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Api/UserApi.md @@ -88,7 +88,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithArrayInput($user); @@ -103,7 +103,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type @@ -141,7 +141,7 @@ $apiInstance = new OpenAPI\Client\Api\UserApi( // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client() ); -$user = array(new \OpenAPI\Client\Model\array()); // \OpenAPI\Client\Model\User[] | List of user object +$user = array(new \OpenAPI\Client\Model\User()); // \OpenAPI\Client\Model\User[] | List of user object try { $apiInstance->createUsersWithListInput($user); @@ -156,7 +156,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**\OpenAPI\Client\Model\User[]**](../Model/array.md)| List of user object | + **user** | [**\OpenAPI\Client\Model\User[]**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/python/docs/UserApi.md b/samples/openapi3/client/petstore/python/docs/UserApi.md index f8a548bd65d..0003f885052 100644 --- a/samples/openapi3/client/petstore/python/docs/UserApi.md +++ b/samples/openapi3/client/petstore/python/docs/UserApi.md @@ -83,7 +83,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -user = None # list[User] | List of user object +user = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -96,7 +96,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**list[User]**](list.md)| List of user object | + **user** | [**list[User]**](User.md)| List of user object | ### Return type @@ -134,7 +134,7 @@ from pprint import pprint # create an instance of the API class api_instance = petstore_api.UserApi() -user = None # list[User] | List of user object +user = [petstore_api.User()] # list[User] | List of user object try: # Creates list of users with given input array @@ -147,7 +147,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**list[User]**](list.md)| List of user object | + **user** | [**list[User]**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/ruby/.rubocop.yml b/samples/openapi3/client/petstore/ruby/.rubocop.yml index e9f19c082d9..0ef33ce5e32 100644 --- a/samples/openapi3/client/petstore/ruby/.rubocop.yml +++ b/samples/openapi3/client/petstore/ruby/.rubocop.yml @@ -46,7 +46,7 @@ Layout/EmptyLinesAroundMethodBody: Layout/EmptyLinesAroundModuleBody: Enabled: true -Layout/FirstParameterIndentation: +Layout/IndentFirstArgument: Enabled: true # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }. diff --git a/samples/openapi3/client/petstore/ruby/README.md b/samples/openapi3/client/petstore/ruby/README.md index 6fb930ed9a8..6be30fc3115 100644 --- a/samples/openapi3/client/petstore/ruby/README.md +++ b/samples/openapi3/client/petstore/ruby/README.md @@ -139,6 +139,12 @@ Class | Method | HTTP request | Description - [Petstore::FormatTest](docs/FormatTest.md) - [Petstore::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Petstore::HealthCheckResult](docs/HealthCheckResult.md) + - [Petstore::InlineObject](docs/InlineObject.md) + - [Petstore::InlineObject1](docs/InlineObject1.md) + - [Petstore::InlineObject2](docs/InlineObject2.md) + - [Petstore::InlineObject3](docs/InlineObject3.md) + - [Petstore::InlineObject4](docs/InlineObject4.md) + - [Petstore::InlineObject5](docs/InlineObject5.md) - [Petstore::InlineResponseDefault](docs/InlineResponseDefault.md) - [Petstore::List](docs/List.md) - [Petstore::MapTest](docs/MapTest.md) diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject.md new file mode 100644 index 00000000000..f5211d44464 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **String** | Updated name of the pet | [optional] +**status** | **String** | Updated status of the pet | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject.new(name: null, + status: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md new file mode 100644 index 00000000000..bac17e753cd --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject1.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **String** | Additional data to pass to server | [optional] +**file** | **File** | file to upload | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject1.new(additional_metadata: null, + file: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md new file mode 100644 index 00000000000..31118c5b262 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject2.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enum_form_string_array** | **Array<String>** | Form parameter enum test (string array) | [optional] +**enum_form_string** | **String** | Form parameter enum test (string) | [optional] [default to '-efg'] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject2.new(enum_form_string_array: null, + enum_form_string: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md new file mode 100644 index 00000000000..b6cb7ccb29b --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject3.md @@ -0,0 +1,43 @@ +# Petstore::InlineObject3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | None | [optional] +**int32** | **Integer** | None | [optional] +**int64** | **Integer** | None | [optional] +**number** | **Float** | None | +**float** | **Float** | None | [optional] +**double** | **Float** | None | +**string** | **String** | None | [optional] +**pattern_without_delimiter** | **String** | None | +**byte** | **String** | None | +**binary** | **File** | None | [optional] +**date** | **Date** | None | [optional] +**date_time** | **DateTime** | None | [optional] +**password** | **String** | None | [optional] +**callback** | **String** | None | [optional] + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject3.new(integer: null, + int32: null, + int64: null, + number: null, + float: null, + double: null, + string: null, + pattern_without_delimiter: null, + byte: null, + binary: null, + date: null, + date_time: null, + password: null, + callback: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md new file mode 100644 index 00000000000..97179c3e377 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject4.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**param** | **String** | field1 | +**param2** | **String** | field2 | + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject4.new(param: null, + param2: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md b/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md new file mode 100644 index 00000000000..23c1df99ffe --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/docs/InlineObject5.md @@ -0,0 +1,19 @@ +# Petstore::InlineObject5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**additional_metadata** | **String** | Additional data to pass to server | [optional] +**required_file** | **File** | file to upload | + +## Code Sample + +```ruby +require 'Petstore' + +instance = Petstore::InlineObject5.new(additional_metadata: null, + required_file: null) +``` + + diff --git a/samples/openapi3/client/petstore/ruby/docs/UserApi.md b/samples/openapi3/client/petstore/ruby/docs/UserApi.md index e3e55065528..631a65ef1f1 100644 --- a/samples/openapi3/client/petstore/ruby/docs/UserApi.md +++ b/samples/openapi3/client/petstore/ruby/docs/UserApi.md @@ -74,7 +74,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -user = nil # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -89,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Array<User>**](Array.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -118,7 +118,7 @@ Creates list of users with given input array require 'petstore' api_instance = Petstore::UserApi.new -user = nil # Array | List of user object +user = [Petstore::User.new] # Array | List of user object begin #Creates list of users with given input array @@ -133,7 +133,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **user** | [**Array<User>**](Array.md)| List of user object | + **user** | [**Array<User>**](User.md)| List of user object | ### Return type diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore.rb b/samples/openapi3/client/petstore/ruby/lib/petstore.rb index f0df2170db0..7f8ae56e123 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore.rb @@ -40,6 +40,12 @@ require 'petstore/models/foo' require 'petstore/models/format_test' require 'petstore/models/has_only_read_only' require 'petstore/models/health_check_result' +require 'petstore/models/inline_object' +require 'petstore/models/inline_object1' +require 'petstore/models/inline_object2' +require 'petstore/models/inline_object3' +require 'petstore/models/inline_object4' +require 'petstore/models/inline_object5' require 'petstore/models/inline_response_default' require 'petstore/models/list' require 'petstore/models/map_test' diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb index 0a961525ffd..dfa6972327d 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/another_fake_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb index 9e29cb08554..eb43bc54bec 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/default_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb index a485c98ff43..6fc2bfdb5be 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb index 89937a770d3..1e44496d5f8 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/fake_classname_tags123_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb index dc985acc69d..4858424f2a0 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -104,7 +103,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.delete_pet" end # resource path - local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -291,7 +290,7 @@ module Petstore 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' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -415,7 +414,7 @@ module Petstore 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' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -481,7 +480,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'pet_id' when calling PetApi.upload_file" end # resource path - local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/pet/{petId}/uploadImage'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -553,7 +552,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'required_file' when calling PetApi.upload_file_with_required_file" end # resource path - local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s)) + local_var_path = '/fake/{petId}/uploadImageWithRequiredFile'.sub('{' + 'petId' + '}', CGI.escape(pet_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb index 710c27691a8..dc4952419a1 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -44,7 +43,7 @@ module Petstore 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' + '}', CGI.escape(order_id.to_s)) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -168,7 +167,7 @@ module Petstore end # resource path - local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s)) + local_var_path = '/store/order/{order_id}'.sub('{' + 'order_id' + '}', CGI.escape(order_id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb index b7b851d48db..b2fbf6be7c6 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -10,7 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' require 'cgi' module Petstore @@ -226,7 +225,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.delete_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -284,7 +283,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'username' when calling UserApi.get_user_by_name" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} @@ -472,7 +471,7 @@ module Petstore fail ArgumentError, "Missing the required parameter 'user' when calling UserApi.update_user" end # resource path - local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s)) + local_var_path = '/user/{username}'.sub('{' + 'username' + '}', CGI.escape(username.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb index a3a78d4b76f..0fd8605b4af 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/api_client.rb @@ -15,7 +15,6 @@ require 'json' require 'logger' require 'tempfile' require 'typhoeus' -require 'uri' module Petstore class ApiClient @@ -262,7 +261,7 @@ module Petstore def build_request_url(path) # Add leading and trailing slashes to path path = "/#{path}".gsub(/\/+/, '/') - URI.encode(@config.base_url + path) + @config.base_url + path end # Builds the HTTP request body diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb index 845abb090c5..938c3b1c062 100644 --- a/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/configuration.rb @@ -10,8 +10,6 @@ OpenAPI Generator version: 5.0.0-SNAPSHOT =end -require 'uri' - module Petstore class Configuration # Defines url scheme @@ -174,8 +172,7 @@ module Petstore end def base_url - url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') - URI.encode(url) + "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '') end # Gets API key (with prefix if set). diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb new file mode 100644 index 00000000000..3fc98931783 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object.rb @@ -0,0 +1,207 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject + # Updated name of the pet + attr_accessor :name + + # Updated status of the pet + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'status' => :'status' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'status' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb new file mode 100644 index 00000000000..e61b19c09b0 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object1.rb @@ -0,0 +1,207 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject1 + # Additional data to pass to server + attr_accessor :additional_metadata + + # file to upload + attr_accessor :file + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'additional_metadata' => :'additionalMetadata', + :'file' => :'file' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'additional_metadata' => :'String', + :'file' => :'File' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject1` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'additional_metadata') + self.additional_metadata = attributes[:'additional_metadata'] + end + + if attributes.key?(:'file') + self.file = attributes[:'file'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + additional_metadata == o.additional_metadata && + file == o.file + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [additional_metadata, file].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb new file mode 100644 index 00000000000..50514beacec --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object2.rb @@ -0,0 +1,245 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject2 + # Form parameter enum test (string array) + attr_accessor :enum_form_string_array + + # Form parameter enum test (string) + attr_accessor :enum_form_string + + class EnumAttributeValidator + attr_reader :datatype + attr_reader :allowable_values + + def initialize(datatype, allowable_values) + @allowable_values = allowable_values.map do |value| + case datatype.to_s + when /Integer/i + value.to_i + when /Float/i + value.to_f + else + value + end + end + end + + def valid?(value) + !value || allowable_values.include?(value) + end + end + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'enum_form_string_array' => :'enum_form_string_array', + :'enum_form_string' => :'enum_form_string' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'enum_form_string_array' => :'Array', + :'enum_form_string' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject2` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject2`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'enum_form_string_array') + if (value = attributes[:'enum_form_string_array']).is_a?(Array) + self.enum_form_string_array = value + end + end + + if attributes.key?(:'enum_form_string') + self.enum_form_string = attributes[:'enum_form_string'] + else + self.enum_form_string = '-efg' + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + enum_form_string_validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + return false unless enum_form_string_validator.valid?(@enum_form_string) + true + end + + # Custom attribute writer method checking allowed values (enum). + # @param [Object] enum_form_string Object to be assigned + def enum_form_string=(enum_form_string) + validator = EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + unless validator.valid?(enum_form_string) + fail ArgumentError, "invalid value for \"enum_form_string\", must be one of #{validator.allowable_values}." + end + @enum_form_string = enum_form_string + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + enum_form_string_array == o.enum_form_string_array && + enum_form_string == o.enum_form_string + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [enum_form_string_array, enum_form_string].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb new file mode 100644 index 00000000000..15245d845c6 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object3.rb @@ -0,0 +1,528 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject3 + # None + attr_accessor :integer + + # None + attr_accessor :int32 + + # None + attr_accessor :int64 + + # None + attr_accessor :number + + # None + attr_accessor :float + + # None + attr_accessor :double + + # None + attr_accessor :string + + # None + attr_accessor :pattern_without_delimiter + + # None + attr_accessor :byte + + # None + attr_accessor :binary + + # None + attr_accessor :date + + # None + attr_accessor :date_time + + # None + attr_accessor :password + + # None + attr_accessor :callback + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'integer' => :'integer', + :'int32' => :'int32', + :'int64' => :'int64', + :'number' => :'number', + :'float' => :'float', + :'double' => :'double', + :'string' => :'string', + :'pattern_without_delimiter' => :'pattern_without_delimiter', + :'byte' => :'byte', + :'binary' => :'binary', + :'date' => :'date', + :'date_time' => :'dateTime', + :'password' => :'password', + :'callback' => :'callback' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'integer' => :'Integer', + :'int32' => :'Integer', + :'int64' => :'Integer', + :'number' => :'Float', + :'float' => :'Float', + :'double' => :'Float', + :'string' => :'String', + :'pattern_without_delimiter' => :'String', + :'byte' => :'String', + :'binary' => :'File', + :'date' => :'Date', + :'date_time' => :'DateTime', + :'password' => :'String', + :'callback' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject3` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject3`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'integer') + self.integer = attributes[:'integer'] + end + + if attributes.key?(:'int32') + self.int32 = attributes[:'int32'] + end + + if attributes.key?(:'int64') + self.int64 = attributes[:'int64'] + end + + if attributes.key?(:'number') + self.number = attributes[:'number'] + end + + if attributes.key?(:'float') + self.float = attributes[:'float'] + end + + if attributes.key?(:'double') + self.double = attributes[:'double'] + end + + if attributes.key?(:'string') + self.string = attributes[:'string'] + end + + if attributes.key?(:'pattern_without_delimiter') + self.pattern_without_delimiter = attributes[:'pattern_without_delimiter'] + end + + if attributes.key?(:'byte') + self.byte = attributes[:'byte'] + end + + if attributes.key?(:'binary') + self.binary = attributes[:'binary'] + end + + if attributes.key?(:'date') + self.date = attributes[:'date'] + end + + if attributes.key?(:'date_time') + self.date_time = attributes[:'date_time'] + end + + if attributes.key?(:'password') + self.password = attributes[:'password'] + end + + if attributes.key?(:'callback') + self.callback = attributes[:'callback'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if !@integer.nil? && @integer > 100 + invalid_properties.push('invalid value for "integer", must be smaller than or equal to 100.') + end + + if !@integer.nil? && @integer < 10 + invalid_properties.push('invalid value for "integer", must be greater than or equal to 10.') + end + + if !@int32.nil? && @int32 > 200 + invalid_properties.push('invalid value for "int32", must be smaller than or equal to 200.') + end + + if !@int32.nil? && @int32 < 20 + invalid_properties.push('invalid value for "int32", must be greater than or equal to 20.') + end + + if @number.nil? + invalid_properties.push('invalid value for "number", number cannot be nil.') + end + + if @number > 543.2 + invalid_properties.push('invalid value for "number", must be smaller than or equal to 543.2.') + end + + if @number < 32.1 + invalid_properties.push('invalid value for "number", must be greater than or equal to 32.1.') + end + + if !@float.nil? && @float > 987.6 + invalid_properties.push('invalid value for "float", must be smaller than or equal to 987.6.') + end + + if @double.nil? + invalid_properties.push('invalid value for "double", double cannot be nil.') + end + + if @double > 123.4 + invalid_properties.push('invalid value for "double", must be smaller than or equal to 123.4.') + end + + if @double < 67.8 + invalid_properties.push('invalid value for "double", must be greater than or equal to 67.8.') + end + + pattern = Regexp.new(/[a-z]/i) + if !@string.nil? && @string !~ pattern + invalid_properties.push("invalid value for \"string\", must conform to the pattern #{pattern}.") + end + + if @pattern_without_delimiter.nil? + invalid_properties.push('invalid value for "pattern_without_delimiter", pattern_without_delimiter cannot be nil.') + end + + pattern = Regexp.new(/^[A-Z].*/) + if @pattern_without_delimiter !~ pattern + invalid_properties.push("invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}.") + end + + if @byte.nil? + invalid_properties.push('invalid value for "byte", byte cannot be nil.') + end + + if !@password.nil? && @password.to_s.length > 64 + invalid_properties.push('invalid value for "password", the character length must be smaller than or equal to 64.') + end + + if !@password.nil? && @password.to_s.length < 10 + invalid_properties.push('invalid value for "password", the character length must be great than or equal to 10.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if !@integer.nil? && @integer > 100 + return false if !@integer.nil? && @integer < 10 + return false if !@int32.nil? && @int32 > 200 + return false if !@int32.nil? && @int32 < 20 + return false if @number.nil? + return false if @number > 543.2 + return false if @number < 32.1 + return false if !@float.nil? && @float > 987.6 + return false if @double.nil? + return false if @double > 123.4 + return false if @double < 67.8 + return false if !@string.nil? && @string !~ Regexp.new(/[a-z]/i) + return false if @pattern_without_delimiter.nil? + return false if @pattern_without_delimiter !~ Regexp.new(/^[A-Z].*/) + return false if @byte.nil? + return false if !@password.nil? && @password.to_s.length > 64 + return false if !@password.nil? && @password.to_s.length < 10 + true + end + + # Custom attribute writer method with validation + # @param [Object] integer Value to be assigned + def integer=(integer) + if !integer.nil? && integer > 100 + fail ArgumentError, 'invalid value for "integer", must be smaller than or equal to 100.' + end + + if !integer.nil? && integer < 10 + fail ArgumentError, 'invalid value for "integer", must be greater than or equal to 10.' + end + + @integer = integer + end + + # Custom attribute writer method with validation + # @param [Object] int32 Value to be assigned + def int32=(int32) + if !int32.nil? && int32 > 200 + fail ArgumentError, 'invalid value for "int32", must be smaller than or equal to 200.' + end + + if !int32.nil? && int32 < 20 + fail ArgumentError, 'invalid value for "int32", must be greater than or equal to 20.' + end + + @int32 = int32 + end + + # Custom attribute writer method with validation + # @param [Object] number Value to be assigned + def number=(number) + if number.nil? + fail ArgumentError, 'number cannot be nil' + end + + if number > 543.2 + fail ArgumentError, 'invalid value for "number", must be smaller than or equal to 543.2.' + end + + if number < 32.1 + fail ArgumentError, 'invalid value for "number", must be greater than or equal to 32.1.' + end + + @number = number + end + + # Custom attribute writer method with validation + # @param [Object] float Value to be assigned + def float=(float) + if !float.nil? && float > 987.6 + fail ArgumentError, 'invalid value for "float", must be smaller than or equal to 987.6.' + end + + @float = float + end + + # Custom attribute writer method with validation + # @param [Object] double Value to be assigned + def double=(double) + if double.nil? + fail ArgumentError, 'double cannot be nil' + end + + if double > 123.4 + fail ArgumentError, 'invalid value for "double", must be smaller than or equal to 123.4.' + end + + if double < 67.8 + fail ArgumentError, 'invalid value for "double", must be greater than or equal to 67.8.' + end + + @double = double + end + + # Custom attribute writer method with validation + # @param [Object] string Value to be assigned + def string=(string) + pattern = Regexp.new(/[a-z]/i) + if !string.nil? && string !~ pattern + fail ArgumentError, "invalid value for \"string\", must conform to the pattern #{pattern}." + end + + @string = string + end + + # Custom attribute writer method with validation + # @param [Object] pattern_without_delimiter Value to be assigned + def pattern_without_delimiter=(pattern_without_delimiter) + if pattern_without_delimiter.nil? + fail ArgumentError, 'pattern_without_delimiter cannot be nil' + end + + pattern = Regexp.new(/^[A-Z].*/) + if pattern_without_delimiter !~ pattern + fail ArgumentError, "invalid value for \"pattern_without_delimiter\", must conform to the pattern #{pattern}." + end + + @pattern_without_delimiter = pattern_without_delimiter + end + + # Custom attribute writer method with validation + # @param [Object] password Value to be assigned + def password=(password) + if !password.nil? && password.to_s.length > 64 + fail ArgumentError, 'invalid value for "password", the character length must be smaller than or equal to 64.' + end + + if !password.nil? && password.to_s.length < 10 + fail ArgumentError, 'invalid value for "password", the character length must be great than or equal to 10.' + end + + @password = password + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + integer == o.integer && + int32 == o.int32 && + int64 == o.int64 && + number == o.number && + float == o.float && + double == o.double && + string == o.string && + pattern_without_delimiter == o.pattern_without_delimiter && + byte == o.byte && + binary == o.binary && + date == o.date && + date_time == o.date_time && + password == o.password && + callback == o.callback + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [integer, int32, int64, number, float, double, string, pattern_without_delimiter, byte, binary, date, date_time, password, callback].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb new file mode 100644 index 00000000000..72c7595b858 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object4.rb @@ -0,0 +1,217 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject4 + # field1 + attr_accessor :param + + # field2 + attr_accessor :param2 + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'param' => :'param', + :'param2' => :'param2' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'param' => :'String', + :'param2' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject4` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject4`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'param') + self.param = attributes[:'param'] + end + + if attributes.key?(:'param2') + self.param2 = attributes[:'param2'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @param.nil? + invalid_properties.push('invalid value for "param", param cannot be nil.') + end + + if @param2.nil? + invalid_properties.push('invalid value for "param2", param2 cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @param.nil? + return false if @param2.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + param == o.param && + param2 == o.param2 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [param, param2].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb new file mode 100644 index 00000000000..fdff4997056 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/lib/petstore/models/inline_object5.rb @@ -0,0 +1,212 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'date' + +module Petstore + class InlineObject5 + # Additional data to pass to server + attr_accessor :additional_metadata + + # file to upload + attr_accessor :required_file + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'additional_metadata' => :'additionalMetadata', + :'required_file' => :'requiredFile' + } + end + + # Attribute type mapping. + def self.openapi_types + { + :'additional_metadata' => :'String', + :'required_file' => :'File' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Petstore::InlineObject5` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Petstore::InlineObject5`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'additional_metadata') + self.additional_metadata = attributes[:'additional_metadata'] + end + + if attributes.key?(:'required_file') + self.required_file = attributes[:'required_file'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @required_file.nil? + invalid_properties.push('invalid value for "required_file", required_file cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @required_file.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + additional_metadata == o.additional_metadata && + required_file == o.required_file + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [additional_metadata, required_file].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.openapi_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + Petstore.const_get(type).build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + end +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb new file mode 100644 index 00000000000..40d5f80b322 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object1_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject1 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject1' do + before do + # run before each test + @instance = Petstore::InlineObject1.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject1' do + it 'should create an instance of InlineObject1' do + expect(@instance).to be_instance_of(Petstore::InlineObject1) + end + end + describe 'test attribute "additional_metadata"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb new file mode 100644 index 00000000000..d9ee4e8d6bd --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object2_spec.rb @@ -0,0 +1,55 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject2 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject2' do + before do + # run before each test + @instance = Petstore::InlineObject2.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject2' do + it 'should create an instance of InlineObject2' do + expect(@instance).to be_instance_of(Petstore::InlineObject2) + end + end + describe 'test attribute "enum_form_string_array"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('Array', [">", "$"]) + # validator.allowable_values.each do |value| + # expect { @instance.enum_form_string_array = value }.not_to raise_error + # end + end + end + + describe 'test attribute "enum_form_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + # validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["_abc", "-efg", "(xyz)"]) + # validator.allowable_values.each do |value| + # expect { @instance.enum_form_string = value }.not_to raise_error + # end + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb new file mode 100644 index 00000000000..2fb2d0acd0a --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object3_spec.rb @@ -0,0 +1,119 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject3 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject3' do + before do + # run before each test + @instance = Petstore::InlineObject3.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject3' do + it 'should create an instance of InlineObject3' do + expect(@instance).to be_instance_of(Petstore::InlineObject3) + end + end + describe 'test attribute "integer"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "int32"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "int64"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "number"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "float"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "double"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "pattern_without_delimiter"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "byte"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "binary"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "date_time"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "password"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "callback"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb new file mode 100644 index 00000000000..467108f38b7 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object4_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject4 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject4' do + before do + # run before each test + @instance = Petstore::InlineObject4.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject4' do + it 'should create an instance of InlineObject4' do + expect(@instance).to be_instance_of(Petstore::InlineObject4) + end + end + describe 'test attribute "param"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "param2"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb new file mode 100644 index 00000000000..76b646c1949 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object5_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject5 +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject5' do + before do + # run before each test + @instance = Petstore::InlineObject5.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject5' do + it 'should create an instance of InlineObject5' do + expect(@instance).to be_instance_of(Petstore::InlineObject5) + end + end + describe 'test attribute "additional_metadata"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "required_file"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb b/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb new file mode 100644 index 00000000000..ccb47629bd3 --- /dev/null +++ b/samples/openapi3/client/petstore/ruby/spec/models/inline_object_spec.rb @@ -0,0 +1,47 @@ +=begin +#OpenAPI Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +The version of the OpenAPI document: 1.0.0 + +Generated by: https://openapi-generator.tech +OpenAPI Generator version: 4.1.0-SNAPSHOT + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::InlineObject +# Automatically generated by openapi-generator (https://openapi-generator.tech) +# Please update as you see appropriate +describe 'InlineObject' do + before do + # run before each test + @instance = Petstore::InlineObject.new + end + + after do + # run after each test + end + + describe 'test an instance of InlineObject' do + it 'should create an instance of InlineObject' do + expect(@instance).to be_instance_of(Petstore::InlineObject) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "status"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION new file mode 100644 index 00000000000..06b5019af3f --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md b/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts new file mode 100644 index 00000000000..f62d3f33c8d --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -0,0 +1,55 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.3.30" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.2.0.M3" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + val kotlinxCoroutinesVersion="1.2.0" + compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + compile("org.jetbrains.kotlin:kotlin-reflect") + compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") + compile("io.swagger:swagger-annotations:1.5.21") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + compile("com.fasterxml.jackson.module:jackson-module-kotlin") + + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml new file mode 100644 index 00000000000..1932017d4bf --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/pom.xml @@ -0,0 +1,151 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.3.30 + 1.2.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.2.0.M3 + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-webflux + + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + + + + io.swagger + swagger-annotations + 1.5.21 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + javax.validation + validation-api + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle new file mode 100644 index 00000000000..e9bd5d32d7c --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/settings.gradle @@ -0,0 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 00000000000..f2ee49d476b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt @@ -0,0 +1,14 @@ +package org.openapitools + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..29de43b1a02 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,186 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Pet", description = "The Pet API") +@RequestMapping("\${api.base-path:/v2}") +class PetApiController(@Autowired(required = true) val service: PetApiService) { + + @ApiOperation( + value = "Add a new pet to the store", + nickname = "addPet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.POST]) + suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { + return ResponseEntity(service.addPet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String? +): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) + @RequestMapping( + value = ["/pet/findByStatus"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List +): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) + @RequestMapping( + value = ["/pet/findByTags"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List +,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: Int? +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long +): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { + return ResponseEntity(service.updatePet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String? +): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 00000000000..2bd53b2a56d --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +interface PetApiService { + + suspend fun addPet(pet: Pet): Unit + + suspend fun deletePet(petId: Long, apiKey: String?): Unit + + fun findPetsByStatus(status: List): Flow + + fun findPetsByTags(tags: List, maxCount: Int?): Flow + + suspend fun getPetById(petId: Long): Pet + + suspend fun updatePet(pet: Pet): Unit + + suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit + + suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 00000000000..009f039d860 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class PetApiServiceImpl : PetApiService { + + override suspend fun addPet(pet: Pet): Unit { + TODO("Implement me") + } + + override suspend fun deletePet(petId: Long, apiKey: String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: List): Flow { + TODO("Implement me") + } + + override fun findPetsByTags(tags: List, maxCount: Int?): Flow { + TODO("Implement me") + } + + override suspend fun getPetById(petId: Long): Pet { + TODO("Implement me") + } + + override suspend fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override suspend fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit { + TODO("Implement me") + } + + override suspend fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..2ee42a77233 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,109 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Store", description = "The Store API") +@RequestMapping("\${api.base-path:/v2}") +class StoreApiController(@Autowired(required = true) val service: StoreApiService) { + + @ApiOperation( + value = "Delete purchase order by ID", + nickname = "deleteOrder", + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + method = [RequestMethod.DELETE]) + suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String +): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + suspend fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.OK) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long +): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order +): ResponseEntity { + return ResponseEntity(service.placeOrder(order), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 00000000000..84dc2837054 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +interface StoreApiService { + + suspend fun deleteOrder(orderId: String): Unit + + suspend fun getInventory(): Map + + suspend fun getOrderById(orderId: Long): Order + + suspend fun placeOrder(order: Order): Order +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 00000000000..f29e7e08c2e --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class StoreApiServiceImpl : StoreApiService { + + override suspend fun deleteOrder(orderId: String): Unit { + TODO("Implement me") + } + + override suspend fun getInventory(): Map { + TODO("Implement me") + } + + override suspend fun getOrderById(orderId: Long): Order { + TODO("Implement me") + } + + override suspend fun placeOrder(order: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..1aed45eebdd --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,172 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "User", description = "The User API") +@RequestMapping("\${api.base-path:/v2}") +class UserApiController(@Autowired(required = true) val service: UserApiService) { + + @ApiOperation( + value = "Create user", + nickname = "createUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { + return ResponseEntity(service.createUser(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithArrayInput", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithArray"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithListInput", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithList"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.DELETE]) + suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String +): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String +): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs out current logged in user session", + nickname = "logoutUser", + notes = "", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/logout"], + method = [RequestMethod.GET]) + suspend fun logoutUser(): ResponseEntity { + return ResponseEntity(service.logoutUser(), HttpStatus.OK) + } + + @ApiOperation( + value = "Updated user", + nickname = "updateUser", + notes = "This can only be done by the logged in user.", + authorizations = [Authorization(value = "auth_cookie")]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + consumes = ["application/json"], + method = [RequestMethod.PUT]) + suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..999ae4f4074 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +interface UserApiService { + + suspend fun createUser(user: User): Unit + + suspend fun createUsersWithArrayInput(user: Flow): Unit + + suspend fun createUsersWithListInput(user: Flow): Unit + + suspend fun deleteUser(username: String): Unit + + suspend fun getUserByName(username: String): User + + suspend fun loginUser(username: String, password: String): String + + suspend fun logoutUser(): Unit + + suspend fun updateUser(username: String, user: User): Unit +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 00000000000..8872d309e4d --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class UserApiServiceImpl : UserApiService { + + override suspend fun createUser(user: User): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithArrayInput(user: Flow): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithListInput(user: Flow): Unit { + TODO("Implement me") + } + + override suspend fun deleteUser(username: String): Unit { + TODO("Implement me") + } + + override suspend fun getUserByName(username: String): User { + TODO("Implement me") + } + + override suspend fun loginUser(username: String, password: String): String { + TODO("Implement me") + } + + override suspend fun logoutUser(): Unit { + TODO("Implement me") + } + + override suspend fun updateUser(username: String, user: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..e042a7f997c --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, +@get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt new file mode 100644 index 00000000000..e998bc995ce --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param name Updated name of the pet + * @param status Updated status of the pet + */ +data class InlineObject ( + + @ApiModelProperty(example = "null", value = "Updated name of the pet") + @JsonProperty("name") val name: String? = null, + + @ApiModelProperty(example = "null", value = "Updated status of the pet") + @JsonProperty("status") val status: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt new file mode 100644 index 00000000000..d29578fd0c0 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/InlineObject1.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ +data class InlineObject1 ( + + @ApiModelProperty(example = "null", value = "Additional data to pass to server") + @JsonProperty("additionalMetadata") val additionalMetadata: String? = null, + + @ApiModelProperty(example = "null", value = "file to upload") + @JsonProperty("file") val file: org.springframework.core.io.Resource? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..2f844a9c356 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") val code: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") val type: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") val message: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..e20d850491f --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,60 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * An order for a pets from the pet store + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ +data class Order ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("petId") val petId: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("quantity") val quantity: Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(example = "null", value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("complete") val complete: Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..9e054ac22f7 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,64 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Tag +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: String, + + @get:NotNull + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: List, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") val tags: List? = null, + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..40ef1b9a86b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..95fe12aa467 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,53 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A User who is purchasing from the pet store + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + */ +data class User ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("username") val username: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("firstName") val firstName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("lastName") val lastName: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("email") val email: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("password") val password: String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("phone") val phone: String? = null, + + @ApiModelProperty(example = "null", value = "User Status") + @JsonProperty("userStatus") val userStatus: Int? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml @@ -0,0 +1,10 @@ +spring: + application: + name: openAPIPetstore + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: 8080 diff --git a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION index afa63656064..06b5019af3f 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION +++ b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.0-SNAPSHOT \ No newline at end of file +4.0.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts index f7a2deac996..26f4601e570 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,15 +23,16 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-web") @@ -40,7 +41,14 @@ dependencies { compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") compile("com.fasterxml.jackson.module:jackson-module-kotlin") + testCompile("org.jetbrains.kotlin:kotlin-test-junit5") testCompile("org.springframework.boot:spring-boot-starter-test") { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml index 96ed05a21d5..10720393bf0 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml +++ b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml @@ -6,12 +6,13 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin @@ -79,6 +80,7 @@ org.springframework.boot spring-boot-starter-web + io.swagger swagger-annotations @@ -105,5 +107,41 @@ javax.validation validation-api + + org.jetbrains.kotlin + kotlin-test-junit5 + 1.3.31 + test +
+ + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle index f0dd035311e..e9bd5d32d7c 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle +++ b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 8f49e172090..7b397708c7a 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -2,11 +2,17 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -14,18 +20,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Pet", description = "The Pet API") @RequestMapping("\${api.base-path:/v2}") @@ -42,7 +54,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.POST]) - fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { return ResponseEntity(service.addPet(pet), HttpStatus.OK) } @@ -56,7 +69,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @RequestMapping( value = ["/pet/{petId}"], method = [RequestMethod.DELETE]) - fun deletePet(@ApiParam(value = "Pet id to delete", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "" , defaultValue="null") @RequestHeader(value="api_key", required=false) apiKey: String): ResponseEntity { + fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? +): ResponseEntity { return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) } @@ -73,7 +88,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "null") @Valid @RequestParam(value = "status", required = true, defaultValue="null") status: List): ResponseEntity> { + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List +): ResponseEntity> { return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) } @@ -90,8 +106,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "null") @Valid @RequestParam(value = "tags", required = true, defaultValue="null") tags: List): ResponseEntity> { - return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List +,@ApiParam(value = "Maximum number of items to return") @Valid @RequestParam(value = "maxCount", required = false) maxCount: kotlin.Int? +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags, maxCount), HttpStatus.OK) } @ApiOperation( @@ -106,7 +124,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getPetById(@ApiParam(value = "ID of pet to return", required=true, defaultValue="null") @PathVariable("petId") petId: Long): ResponseEntity { + fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long +): ResponseEntity { return ResponseEntity(service.getPetById(petId), HttpStatus.OK) } @@ -121,7 +140,8 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet"], consumes = ["application/json", "application/xml"], method = [RequestMethod.PUT]) - fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet +): ResponseEntity { return ResponseEntity(service.updatePet(pet), HttpStatus.OK) } @@ -136,7 +156,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], consumes = ["application/x-www-form-urlencoded"], method = [RequestMethod.POST]) - fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? +): ResponseEntity { return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) } @@ -153,7 +176,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"], method = [RequestMethod.POST]) - fun uploadFile(@ApiParam(value = "ID of pet to update", required=true, defaultValue="null") @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index c2e81c4c66b..89bae4c1ceb 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -2,22 +2,21 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet - interface PetApiService { - fun addPet(pet: Pet): Unit + fun addPet(pet: Pet): Unit - fun deletePet(petId: Long,apiKey: String): Unit + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit - fun findPetsByStatus(status: List): List + fun findPetsByStatus(status: kotlin.collections.List): List - fun findPetsByTags(tags: List): List + fun findPetsByTags(tags: kotlin.collections.List, maxCount: kotlin.Int?): List - fun getPetById(petId: Long): Pet + fun getPetById(petId: kotlin.Long): Pet - fun updatePet(pet: Pet): Unit + fun updatePet(pet: Pet): Unit - fun updatePetWithForm(petId: Long,name: String,status: String): Unit + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit - fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 86ae8e06320..26900dc599d 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -3,7 +3,6 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet import org.springframework.stereotype.Service - @Service class PetApiServiceImpl : PetApiService { @@ -11,19 +10,19 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun deletePet(petId: Long,apiKey: String): Unit { + override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit { TODO("Implement me") } - override fun findPetsByStatus(status: List): List { + override fun findPetsByStatus(status: kotlin.collections.List): List { TODO("Implement me") } - override fun findPetsByTags(tags: List): List { + override fun findPetsByTags(tags: kotlin.collections.List, maxCount: kotlin.Int?): List { TODO("Implement me") } - override fun getPetById(petId: Long): Pet { + override fun getPetById(petId: kotlin.Long): Pet { TODO("Implement me") } @@ -31,11 +30,11 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun updatePetWithForm(petId: Long,name: String,status: String): Unit { + override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit { TODO("Implement me") } - override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index 6931bd2500c..16104fb0d22 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -1,11 +1,17 @@ package org.openapitools.api import org.openapitools.model.Order -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Store", description = "The Store API") @RequestMapping("\${api.base-path:/v2}") @@ -39,7 +51,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @RequestMapping( value = ["/store/order/{orderId}"], method = [RequestMethod.DELETE]) - fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true, defaultValue="null") @PathVariable("orderId") orderId: String): ResponseEntity { + fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String +): ResponseEntity { return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) } @@ -47,16 +60,16 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", - response = Int::class, + response = kotlin.Int::class, responseContainer = "Map", authorizations = [Authorization(value = "api_key")]) @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) @RequestMapping( value = ["/store/inventory"], produces = ["application/json"], method = [RequestMethod.GET]) - fun getInventory(): ResponseEntity> { + fun getInventory(): ResponseEntity> { return ResponseEntity(service.getInventory(), HttpStatus.OK) } @@ -71,7 +84,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true, defaultValue="null") @PathVariable("orderId") orderId: Long): ResponseEntity { + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long +): ResponseEntity { return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) } @@ -87,7 +101,8 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic produces = ["application/xml", "application/json"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity { + fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order +): ResponseEntity { return ResponseEntity(service.placeOrder(order), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt index 7767fa87a8a..5fa51ca922e 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -1,14 +1,13 @@ package org.openapitools.api import org.openapitools.model.Order - interface StoreApiService { - fun deleteOrder(orderId: String): Unit + fun deleteOrder(orderId: kotlin.String): Unit - fun getInventory(): Map + fun getInventory(): Map - fun getOrderById(orderId: Long): Order + fun getOrderById(orderId: kotlin.Long): Order - fun placeOrder(order: Order): Order + fun placeOrder(order: Order): Order } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt index 850853758fe..70e1e76b06b 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -2,19 +2,18 @@ package org.openapitools.api import org.openapitools.model.Order import org.springframework.stereotype.Service - @Service class StoreApiServiceImpl : StoreApiService { - override fun deleteOrder(orderId: String): Unit { + override fun deleteOrder(orderId: kotlin.String): Unit { TODO("Implement me") } - override fun getInventory(): Map { + override fun getInventory(): Map { TODO("Implement me") } - override fun getOrderById(orderId: Long): Order { + override fun getOrderById(orderId: kotlin.Long): Order { TODO("Implement me") } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index 71d5afca249..bd7583274b5 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -1,11 +1,17 @@ package org.openapitools.api import org.openapitools.model.User -import io.swagger.annotations.* +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -13,18 +19,24 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest -import org.springframework.web.multipart.MultipartFile import org.springframework.beans.factory.annotation.Autowired import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "User", description = "The User API") @RequestMapping("\${api.base-path:/v2}") @@ -41,7 +53,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { return ResponseEntity(service.createUser(user), HttpStatus.OK) } @@ -56,7 +69,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithArray"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: kotlin.collections.List +): ResponseEntity { return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) } @@ -71,7 +85,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/createWithList"], consumes = ["application/json"], method = [RequestMethod.POST]) - fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: kotlin.collections.List +): ResponseEntity { return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) } @@ -85,7 +100,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.DELETE]) - fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { + fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String +): ResponseEntity { return ResponseEntity(service.deleteUser(username), HttpStatus.OK) } @@ -100,7 +116,8 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true, defaultValue="null") @PathVariable("username") username: String): ResponseEntity { + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String +): ResponseEntity { return ResponseEntity(service.getUserByName(username), HttpStatus.OK) } @@ -108,14 +125,16 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = "Logs user into the system", nickname = "loginUser", notes = "", - response = String::class) + response = kotlin.String::class) @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) @RequestMapping( value = ["/user/login"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true, defaultValue = "null") @Valid @RequestParam(value = "username", required = true, defaultValue="null") username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true, defaultValue = "null") @Valid @RequestParam(value = "password", required = true, defaultValue="null") password: String): ResponseEntity { + fun loginUser(@NotNull @Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String +): ResponseEntity { return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) } @@ -144,7 +163,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], consumes = ["application/json"], method = [RequestMethod.PUT]) - fun updateUser(@ApiParam(value = "name that need to be deleted", required=true, defaultValue="null") @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User +): ResponseEntity { return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt index b8a3d7ebae1..d64d09e8314 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -1,22 +1,21 @@ package org.openapitools.api import org.openapitools.model.User - interface UserApiService { - fun createUser(user: User): Unit + fun createUser(user: User): Unit - fun createUsersWithArrayInput(user: List): Unit + fun createUsersWithArrayInput(user: kotlin.collections.List): Unit - fun createUsersWithListInput(user: List): Unit + fun createUsersWithListInput(user: kotlin.collections.List): Unit - fun deleteUser(username: String): Unit + fun deleteUser(username: kotlin.String): Unit - fun getUserByName(username: String): User + fun getUserByName(username: kotlin.String): User - fun loginUser(username: String,password: String): String + fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String - fun logoutUser(): Unit + fun logoutUser(): Unit - fun updateUser(username: String,user: User): Unit + fun updateUser(username: kotlin.String, user: User): Unit } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 62b365a6d82..0c24688975c 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -2,7 +2,6 @@ package org.openapitools.api import org.openapitools.model.User import org.springframework.stereotype.Service - @Service class UserApiServiceImpl : UserApiService { @@ -10,23 +9,23 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun createUsersWithArrayInput(user: List): Unit { + override fun createUsersWithArrayInput(user: kotlin.collections.List): Unit { TODO("Implement me") } - override fun createUsersWithListInput(user: List): Unit { + override fun createUsersWithListInput(user: kotlin.collections.List): Unit { TODO("Implement me") } - override fun deleteUser(username: String): Unit { + override fun deleteUser(username: kotlin.String): Unit { TODO("Implement me") } - override fun getUserByName(username: String): User { + override fun getUserByName(username: kotlin.String): User { TODO("Implement me") } - override fun loginUser(username: String,password: String): String { + override fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { TODO("Implement me") } @@ -34,7 +33,7 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun updateUser(username: String,user: User): Unit { + override fun updateUser(username: kotlin.String, user: User): Unit { TODO("Implement me") } } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index 499ed4743e1..4be27d19748 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -14,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class Category ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @get:Pattern(regexp="^[a-zA-Z0-9]+[a-zA-Z0-9\\.\\-_]*[a-zA-Z0-9]+$") @ApiModelProperty(example = "null", value = "") - @JsonProperty("name") val name: String? = null + @JsonProperty("name") val name: kotlin.String? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt index 3a1526a0db7..ee034530c63 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -14,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class InlineObject ( @ApiModelProperty(example = "null", value = "Updated name of the pet") - @JsonProperty("name") val name: String? = null, + @JsonProperty("name") val name: kotlin.String? = null, @ApiModelProperty(example = "null", value = "Updated status of the pet") - @JsonProperty("status") val status: String? = null + @JsonProperty("status") val status: kotlin.String? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt index 4600798bc9a..a289d8c05f7 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/InlineObject1.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -14,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class InlineObject1 ( @ApiModelProperty(example = "null", value = "Additional data to pass to server") - @JsonProperty("additionalMetadata") val additionalMetadata: String? = null, + @JsonProperty("additionalMetadata") val additionalMetadata: kotlin.String? = null, @ApiModelProperty(example = "null", value = "file to upload") - @JsonProperty("file") val file: java.io.File? = null + @JsonProperty("file") val file: org.springframework.core.io.Resource? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 17697fdfe8d..0e86b28e937 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -15,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty data class ModelApiResponse ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("code") val code: Int? = null, + @JsonProperty("code") val code: kotlin.Int? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("type") val type: String? = null, + @JsonProperty("type") val type: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("message") val message: String? = null + @JsonProperty("message") val message: kotlin.String? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index be8e2f33fb3..08726893f7d 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -3,8 +3,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonValue -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -19,13 +24,13 @@ import io.swagger.annotations.ApiModelProperty data class Order ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("petId") val petId: Long? = null, + @JsonProperty("petId") val petId: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("quantity") val quantity: Int? = null, + @JsonProperty("quantity") val quantity: kotlin.Int? = null, @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, @@ -34,14 +39,14 @@ data class Order ( @JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("complete") val complete: Boolean? = null + @JsonProperty("complete") val complete: kotlin.Boolean? = null ) { /** * Order Status * Values: placed,approved,delivered */ - enum class Status(val value: String) { + enum class Status(val value: kotlin.String) { @JsonProperty("placed") placed("placed"), diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index 80af728b7e4..4a2e9d26cb9 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -5,8 +5,13 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.annotation.JsonValue import org.openapitools.model.Category import org.openapitools.model.Tag -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -22,20 +27,20 @@ data class Pet ( @get:NotNull @ApiModelProperty(example = "doggie", required = true, value = "") - @JsonProperty("name") val name: String, + @JsonProperty("name") val name: kotlin.String, @get:NotNull @ApiModelProperty(example = "null", required = true, value = "") - @JsonProperty("photoUrls") val photoUrls: List, + @JsonProperty("photoUrls") val photoUrls: kotlin.collections.List, @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") @JsonProperty("category") val category: Category? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("tags") val tags: List? = null, + @JsonProperty("tags") val tags: kotlin.collections.List? = null, @ApiModelProperty(example = "null", value = "pet status in the store") @JsonProperty("status") val status: Pet.Status? = null @@ -45,7 +50,7 @@ data class Pet ( * pet status in the store * Values: available,pending,sold */ - enum class Status(val value: String) { + enum class Status(val value: kotlin.String) { @JsonProperty("available") available("available"), diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 70c706d00a6..df04dcd035d 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -14,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class Tag ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("name") val name: String? = null + @JsonProperty("name") val name: kotlin.String? = null ) { } diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index 4cfaf098874..619b2e7c2c3 100644 --- a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -2,8 +2,13 @@ package org.openapitools.model import java.util.Objects import com.fasterxml.jackson.annotation.JsonProperty -import javax.validation.Valid -import javax.validation.constraints.* +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size import io.swagger.annotations.ApiModelProperty /** @@ -20,28 +25,28 @@ import io.swagger.annotations.ApiModelProperty data class User ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("username") val username: String? = null, + @JsonProperty("username") val username: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("firstName") val firstName: String? = null, + @JsonProperty("firstName") val firstName: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("lastName") val lastName: String? = null, + @JsonProperty("lastName") val lastName: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("email") val email: String? = null, + @JsonProperty("email") val email: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("password") val password: String? = null, + @JsonProperty("password") val password: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("phone") val phone: String? = null, + @JsonProperty("phone") val phone: kotlin.String? = null, @ApiModelProperty(example = "null", value = "User Status") - @JsonProperty("userStatus") val userStatus: Int? = null + @JsonProperty("userStatus") val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs new file mode 100644 index 00000000000..bde72d78080 --- /dev/null +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Authentication/ApiAuthentication.cs @@ -0,0 +1,47 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc.Filters; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace Org.OpenAPITools.Authentication +{ + public class ApiKeyRequirement : IAuthorizationRequirement + { + public IReadOnlyList ApiKeys { get; set; } + + public string PolicyName { get; set; } + + public ApiKeyRequirement(IEnumerable apiKeys, string policyName) + { + ApiKeys = apiKeys?.ToList() ?? new List(); + PolicyName = policyName; + } + } + + public class ApiKeyRequirementHandler : AuthorizationHandler + { + + protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + SucceedRequirementIfApiKeyPresentAndValid(context, requirement); + return Task.CompletedTask; + } + + private void SucceedRequirementIfApiKeyPresentAndValid(AuthorizationHandlerContext context, ApiKeyRequirement requirement) + { + + if (context.Resource is AuthorizationFilterContext authorizationFilterContext) + { + var apiKey = ""; + apiKey = authorizationFilterContext.HttpContext.Request.Headers["api_key"].FirstOrDefault(); + if (requirement.PolicyName == "api_key" && apiKey != null && requirement.ApiKeys.Any(requiredApiKey => apiKey == requiredApiKey)) + { + context.Succeed(requirement); + } + + } + } +} + diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs index a945134b8a9..0df59c9002d 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -17,6 +17,7 @@ using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; using Org.OpenAPITools.Attributes; using Org.OpenAPITools.Models; +using Microsoft.AspNetCore.Authorization; namespace Org.OpenAPITools.Controllers { @@ -135,6 +136,7 @@ namespace Org.OpenAPITools.Controllers /// Pet not found [HttpGet] [Route("/v2/pet/{petId}")] + [Authorize(Policy = "api_key")] [ValidateModelState] [SwaggerOperation("GetPetById")] [SwaggerResponse(statusCode: 200, type: typeof(Pet), description: "successful operation")] diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs index 1e981d697ae..a94c4a7c243 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -17,6 +17,7 @@ using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; using Org.OpenAPITools.Attributes; using Org.OpenAPITools.Models; +using Microsoft.AspNetCore.Authorization; namespace Org.OpenAPITools.Controllers { @@ -56,6 +57,7 @@ namespace Org.OpenAPITools.Controllers /// successful operation [HttpGet] [Route("/v2/store/inventory")] + [Authorize(Policy = "api_key")] [ValidateModelState] [SwaggerOperation("GetInventory")] [SwaggerResponse(statusCode: 200, type: typeof(Dictionary), description: "successful operation")] diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs index 7c455f25a57..c3a29ff7aed 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -17,6 +17,7 @@ using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; using Org.OpenAPITools.Attributes; using Org.OpenAPITools.Models; +using Microsoft.AspNetCore.Authorization; namespace Org.OpenAPITools.Controllers { diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs index ece2c98eca5..dc255939dc9 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs @@ -21,6 +21,8 @@ using Newtonsoft.Json.Serialization; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; using Org.OpenAPITools.Filters; +using Org.OpenAPITools.Authentication; +using Microsoft.AspNetCore.Authorization; namespace Org.OpenAPITools { @@ -49,6 +51,13 @@ namespace Org.OpenAPITools /// public void ConfigureServices(IServiceCollection services) { + services.AddTransient(); + services.AddAuthorization(authConfig => + { + authConfig.AddPolicy("api_key", + policyBuilder => policyBuilder + .AddRequirements(new ApiKeyRequirement(new[] { "my-secret-key" },"api_key"))); + // Add framework services. services .AddMvc() diff --git a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION index 06b5019af3f..d96260ba335 100644 --- a/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-pistache/.openapi-generator/VERSION @@ -1 +1 @@ -4.0.1-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object.cpp new file mode 100644 index 00000000000..ebb31303908 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Inline_object.cpp @@ -0,0 +1,101 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Inline_object.h" + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +Inline_object::Inline_object() +{ + m_Name = ""; + m_NameIsSet = false; + m_Status = ""; + m_StatusIsSet = false; + +} + +Inline_object::~Inline_object() +{ +} + +void Inline_object::validate() +{ + // TODO: implement validation +} + +void to_json(nlohmann::json& j, const Inline_object& o) +{ + j = nlohmann::json(); + if(o.nameIsSet()) + j["name"] = o.m_Name; + if(o.statusIsSet()) + j["status"] = o.m_Status; +} + +void from_json(const nlohmann::json& j, Inline_object& o) +{ + if(j.contains("name")) + { + j.at("name").get_to(o.m_Name); + o.m_NameIsSet = true; + } + if(j.contains("status")) + { + j.at("status").get_to(o.m_Status); + o.m_StatusIsSet = true; + } +} + +std::string Inline_object::getName() const +{ + return m_Name; +} +void Inline_object::setName(std::string const& value) +{ + m_Name = value; + m_NameIsSet = true; +} +bool Inline_object::nameIsSet() const +{ + return m_NameIsSet; +} +void Inline_object::unsetName() +{ + m_NameIsSet = false; +} +std::string Inline_object::getStatus() const +{ + return m_Status; +} +void Inline_object::setStatus(std::string const& value) +{ + m_Status = value; + m_StatusIsSet = true; +} +bool Inline_object::statusIsSet() const +{ + return m_StatusIsSet; +} +void Inline_object::unsetStatus() +{ + m_StatusIsSet = false; +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object.h b/samples/server/petstore/cpp-pistache/model/Inline_object.h new file mode 100644 index 00000000000..f407884cd88 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Inline_object.h @@ -0,0 +1,73 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Inline_object.h + * + * + */ + +#ifndef Inline_object_H_ +#define Inline_object_H_ + + +#include +#include + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +/// +/// +/// +class Inline_object +{ +public: + Inline_object(); + virtual ~Inline_object(); + + void validate(); + + ///////////////////////////////////////////// + /// Inline_object members + + /// + /// Updated name of the pet + /// + std::string getName() const; + void setName(std::string const& value); + bool nameIsSet() const; + void unsetName(); + /// + /// Updated status of the pet + /// + std::string getStatus() const; + void setStatus(std::string const& value); + bool statusIsSet() const; + void unsetStatus(); + + friend void to_json(nlohmann::json& j, const Inline_object& o); + friend void from_json(const nlohmann::json& j, Inline_object& o); +protected: + std::string m_Name; + bool m_NameIsSet; + std::string m_Status; + bool m_StatusIsSet; +}; + +} +} +} +} + +#endif /* Inline_object_H_ */ diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp b/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp new file mode 100644 index 00000000000..d5ffe1fef88 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Inline_object_1.cpp @@ -0,0 +1,100 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ + + +#include "Inline_object_1.h" + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +Inline_object_1::Inline_object_1() +{ + m_AdditionalMetadata = ""; + m_AdditionalMetadataIsSet = false; + m_fileIsSet = false; + +} + +Inline_object_1::~Inline_object_1() +{ +} + +void Inline_object_1::validate() +{ + // TODO: implement validation +} + +void to_json(nlohmann::json& j, const Inline_object_1& o) +{ + j = nlohmann::json(); + if(o.additionalMetadataIsSet()) + j["additionalMetadata"] = o.m_AdditionalMetadata; + if(o.fileIsSet()) + j["file"] = o.m_file; +} + +void from_json(const nlohmann::json& j, Inline_object_1& o) +{ + if(j.contains("additionalMetadata")) + { + j.at("additionalMetadata").get_to(o.m_AdditionalMetadata); + o.m_AdditionalMetadataIsSet = true; + } + if(j.contains("file")) + { + j.at("file").get_to(o.m_file); + o.m_fileIsSet = true; + } +} + +std::string Inline_object_1::getAdditionalMetadata() const +{ + return m_AdditionalMetadata; +} +void Inline_object_1::setAdditionalMetadata(std::string const& value) +{ + m_AdditionalMetadata = value; + m_AdditionalMetadataIsSet = true; +} +bool Inline_object_1::additionalMetadataIsSet() const +{ + return m_AdditionalMetadataIsSet; +} +void Inline_object_1::unsetAdditionalMetadata() +{ + m_AdditionalMetadataIsSet = false; +} +std::string Inline_object_1::getFile() const +{ + return m_file; +} +void Inline_object_1::setFile(std::string const& value) +{ + m_file = value; + m_fileIsSet = true; +} +bool Inline_object_1::fileIsSet() const +{ + return m_fileIsSet; +} +void Inline_object_1::unsetfile() +{ + m_fileIsSet = false; +} + +} +} +} +} + diff --git a/samples/server/petstore/cpp-pistache/model/Inline_object_1.h b/samples/server/petstore/cpp-pistache/model/Inline_object_1.h new file mode 100644 index 00000000000..a5d90b1754e --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Inline_object_1.h @@ -0,0 +1,73 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* The version of the OpenAPI document: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Inline_object_1.h + * + * + */ + +#ifndef Inline_object_1_H_ +#define Inline_object_1_H_ + + +#include +#include + +namespace org { +namespace openapitools { +namespace server { +namespace model { + +/// +/// +/// +class Inline_object_1 +{ +public: + Inline_object_1(); + virtual ~Inline_object_1(); + + void validate(); + + ///////////////////////////////////////////// + /// Inline_object_1 members + + /// + /// Additional data to pass to server + /// + std::string getAdditionalMetadata() const; + void setAdditionalMetadata(std::string const& value); + bool additionalMetadataIsSet() const; + void unsetAdditionalMetadata(); + /// + /// file to upload + /// + std::string getFile() const; + void setFile(std::string const& value); + bool fileIsSet() const; + void unsetfile(); + + friend void to_json(nlohmann::json& j, const Inline_object_1& o); + friend void from_json(const nlohmann::json& j, Inline_object_1& o); +protected: + std::string m_AdditionalMetadata; + bool m_AdditionalMetadataIsSet; + std::string m_file; + bool m_fileIsSet; +}; + +} +} +} +} + +#endif /* Inline_object_1_H_ */ diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h index b28590dd38a..2fe8209ac10 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.h @@ -76,4 +76,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIApiResponse) + #endif // OAIApiResponse_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h index 0586cb3d4e1..129d9748576 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.h @@ -68,4 +68,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAICategory) + #endif // OAICategory_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIEnum.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIEnum.h index 42daef17ac1..a5e619960fb 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIEnum.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIEnum.h @@ -15,6 +15,7 @@ #include #include +#include namespace OpenAPI { @@ -61,4 +62,6 @@ private : } +Q_DECLARE_METATYPE(OpenAPI::OAIEnum) + #endif // OAI_ENUM_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h index 9cc379894ca..babc1e64fbb 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h @@ -15,6 +15,7 @@ #include #include +#include namespace OpenAPI { @@ -63,4 +64,6 @@ private : } +Q_DECLARE_METATYPE(OpenAPI::OAIObject) + #endif // OAI_OBJECT_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h index eb9edd329e3..c9b006d3632 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.h @@ -101,4 +101,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIOrder) + #endif // OAIOrder_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h index ffeb4ba5ad7..6bec604d216 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.h @@ -103,4 +103,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIPet) + #endif // OAIPet_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h index 2a497cf1bd7..497a021f085 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.h @@ -68,4 +68,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAITag) + #endif // OAITag_H diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h index d388f62a29b..556de322584 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.h @@ -116,4 +116,6 @@ private: } +Q_DECLARE_METATYPE(OpenAPI::OAIUser) + #endif // OAIUser_H diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index 8cf0da5c953..67ecc530a56 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index 8cf0da5c953..67ecc530a56 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt index 1ebd2ba22c3..2b0cd5cdb5f 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/AppMain.kt @@ -21,9 +21,9 @@ import io.ktor.locations.Locations import io.ktor.metrics.Metrics import io.ktor.routing.Routing import java.util.concurrent.TimeUnit +import io.ktor.util.KtorExperimentalAPI import io.ktor.auth.Authentication import io.ktor.auth.oauth -import io.ktor.util.KtorExperimentalAPI import org.openapitools.server.infrastructure.ApiKeyCredential import org.openapitools.server.infrastructure.ApiPrincipal import org.openapitools.server.infrastructure.apiKeyAuth diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION new file mode 100644 index 00000000000..83a328a9227 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.1.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/README.md b/samples/server/petstore/kotlin-springboot-reactive/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts new file mode 100644 index 00000000000..f4561be14be --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/build.gradle.kts @@ -0,0 +1,57 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.3.30" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.2.0.M3" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + val kotlinxCoroutinesVersion="1.2.0" + compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + compile("org.jetbrains.kotlin:kotlin-reflect") + compile("org.springframework.boot:spring-boot-starter-webflux") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$kotlinxCoroutinesVersion") + compile("io.swagger:swagger-annotations:1.5.21") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + compile("com.fasterxml.jackson.module:jackson-module-kotlin") + + testCompile("org.jetbrains.kotlin:kotlin-test-junit5") + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } + testCompile("org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlinxCoroutinesVersion") +} + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/pom.xml b/samples/server/petstore/kotlin-springboot-reactive/pom.xml new file mode 100644 index 00000000000..c8683e54bc2 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/pom.xml @@ -0,0 +1,157 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.3.30 + 1.2.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.2.0.M3 + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + spring + + 1.8 + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + org.jetbrains.kotlin + kotlin-maven-allopen + ${kotlin.version} + + + + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.jetbrains.kotlin + kotlin-reflect + ${kotlin.version} + + + org.springframework.boot + spring-boot-starter-webflux + + + org.jetbrains.kotlinx + kotlinx-coroutines-core + ${kotlinx-coroutines.version} + + + org.jetbrains.kotlinx + kotlinx-coroutines-reactor + ${kotlinx-coroutines.version} + + + + io.swagger + swagger-annotations + 1.5.21 + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + com.fasterxml.jackson.module + jackson-module-kotlin + + + + javax.validation + validation-api + + + org.jetbrains.kotlin + kotlin-test-junit5 + 1.3.31 + test + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + diff --git a/samples/server/petstore/kotlin-springboot-reactive/settings.gradle b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle new file mode 100644 index 00000000000..e9bd5d32d7c --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/settings.gradle @@ -0,0 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 00000000000..f2ee49d476b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/Application.kt @@ -0,0 +1,14 @@ +package org.openapitools + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..c8273a4ac4a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,185 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Pet", description = "The Pet API") +@RequestMapping("\${api.base-path:/v2}") +class PetApiController(@Autowired(required = true) val service: PetApiService) { + + @ApiOperation( + value = "Add a new pet to the store", + nickname = "addPet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.POST]) + suspend fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet +): ResponseEntity { + return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405)) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + suspend fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? +): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400)) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid status value")]) + @RequestMapping( + value = ["/pet/findByStatus"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List +): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class, responseContainer = "List"),ApiResponse(code = 400, message = "Invalid tag value")]) + @RequestMapping( + value = ["/pet/findByTags"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List +): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long +): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + suspend fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet +): ResponseEntity { + return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400)) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + suspend fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? +): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405)) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + suspend fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? +,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? +): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 00000000000..572dfddca6a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +interface PetApiService { + + suspend fun addPet(body: Pet): Unit + + suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit + + fun findPetsByStatus(status: kotlin.collections.List): Flow + + fun findPetsByTags(tags: kotlin.collections.List): Flow + + suspend fun getPetById(petId: kotlin.Long): Pet + + suspend fun updatePet(body: Pet): Unit + + suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit + + suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 00000000000..1013dd81f92 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class PetApiServiceImpl : PetApiService { + + override suspend fun addPet(body: Pet): Unit { + TODO("Implement me") + } + + override suspend fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: kotlin.collections.List): Flow { + TODO("Implement me") + } + + override fun findPetsByTags(tags: kotlin.collections.List): Flow { + TODO("Implement me") + } + + override suspend fun getPetById(petId: kotlin.Long): Pet { + TODO("Implement me") + } + + override suspend fun updatePet(body: Pet): Unit { + TODO("Implement me") + } + + override suspend fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit { + TODO("Implement me") + } + + override suspend fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..c02953e92ad --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,108 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "Store", description = "The Store API") +@RequestMapping("\${api.base-path:/v2}") +class StoreApiController(@Autowired(required = true) val service: StoreApiService) { + + @ApiOperation( + value = "Delete purchase order by ID", + nickname = "deleteOrder", + notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + method = [RequestMethod.DELETE]) + suspend fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String +): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = kotlin.Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + suspend fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long +): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.POST]) + suspend fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order +): ResponseEntity { + return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200)) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 00000000000..fbc5b1729e4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +interface StoreApiService { + + suspend fun deleteOrder(orderId: kotlin.String): Unit + + suspend fun getInventory(): Map + + suspend fun getOrderById(orderId: kotlin.Long): Order + + suspend fun placeOrder(body: Order): Order +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 00000000000..4220a2900c4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class StoreApiServiceImpl : StoreApiService { + + override suspend fun deleteOrder(orderId: kotlin.String): Unit { + TODO("Implement me") + } + + override suspend fun getInventory(): Map { + TODO("Implement me") + } + + override suspend fun getOrderById(orderId: kotlin.Long): Order { + TODO("Implement me") + } + + override suspend fun placeOrder(body: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..1cb3dc04a5e --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,162 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.Api +import io.swagger.annotations.ApiOperation +import io.swagger.annotations.ApiParam +import io.swagger.annotations.ApiResponse +import io.swagger.annotations.ApiResponses +import io.swagger.annotations.Authorization +import io.swagger.annotations.AuthorizationScope +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity + +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +import org.springframework.web.bind.annotation.PathVariable +import org.springframework.web.bind.annotation.RequestHeader +import org.springframework.web.bind.annotation.RequestMethod +import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController +import org.springframework.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size + +import kotlinx.coroutines.flow.Flow; +import kotlin.collections.List +import kotlin.collections.Map + +@RestController +@Validated +@Api(value = "User", description = "The User API") +@RequestMapping("\${api.base-path:/v2}") +class UserApiController(@Autowired(required = true) val service: UserApiService) { + + @ApiOperation( + value = "Create user", + nickname = "createUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user"], + method = [RequestMethod.POST]) + suspend fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User +): ResponseEntity { + return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithArrayInput", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithArray"], + method = [RequestMethod.POST]) + suspend fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithListInput", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithList"], + method = [RequestMethod.POST]) + suspend fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: Flow +): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.DELETE]) + suspend fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String +): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String +): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = kotlin.String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + suspend fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String +): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Logs out current logged in user session", + nickname = "logoutUser", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/logout"], + method = [RequestMethod.GET]) + suspend fun logoutUser(): ResponseEntity { + return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) + } + + @ApiOperation( + value = "Updated user", + nickname = "updateUser", + notes = "This can only be done by the logged in user.") + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid user supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + method = [RequestMethod.PUT]) + suspend fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String +,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User +): ResponseEntity { + return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400)) + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..ceb24849483 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +interface UserApiService { + + suspend fun createUser(body: User): Unit + + suspend fun createUsersWithArrayInput(body: Flow): Unit + + suspend fun createUsersWithListInput(body: Flow): Unit + + suspend fun deleteUser(username: kotlin.String): Unit + + suspend fun getUserByName(username: kotlin.String): User + + suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String + + suspend fun logoutUser(): Unit + + suspend fun updateUser(username: kotlin.String, body: User): Unit +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 00000000000..3316a4c4138 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import kotlinx.coroutines.flow.Flow; +import org.springframework.stereotype.Service +@Service +class UserApiServiceImpl : UserApiService { + + override suspend fun createUser(body: User): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithArrayInput(body: Flow): Unit { + TODO("Implement me") + } + + override suspend fun createUsersWithListInput(body: Flow): Unit { + TODO("Implement me") + } + + override suspend fun deleteUser(username: kotlin.String): Unit { + TODO("Implement me") + } + + override suspend fun getUserByName(username: kotlin.String): User { + TODO("Implement me") + } + + override suspend fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { + TODO("Implement me") + } + + override suspend fun logoutUser(): Unit { + TODO("Implement me") + } + + override suspend fun updateUser(username: kotlin.String, body: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..f477eb4e7a8 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..0e86b28e937 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,33 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("code") val code: kotlin.Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("type") val type: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("message") val message: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..08726893f7d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,60 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * An order for a pets from the pet store + * @param id + * @param petId + * @param quantity + * @param shipDate + * @param status Order Status + * @param complete + */ +data class Order ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("petId") val petId: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("quantity") val quantity: kotlin.Int? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(example = "null", value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("complete") val complete: kotlin.Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: kotlin.String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..4a2e9d26cb9 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,64 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import org.openapitools.model.Category +import org.openapitools.model.Tag +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: kotlin.String, + + @get:NotNull + @ApiModelProperty(example = "null", required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: kotlin.collections.List, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("tags") val tags: kotlin.collections.List? = null, + + @ApiModelProperty(example = "null", value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: kotlin.String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..df04dcd035d --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,29 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("name") val name: kotlin.String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..619b2e7c2c3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,53 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.constraints.DecimalMax +import javax.validation.constraints.DecimalMin +import javax.validation.constraints.Max +import javax.validation.constraints.Min +import javax.validation.constraints.NotNull +import javax.validation.constraints.Pattern +import javax.validation.constraints.Size +import io.swagger.annotations.ApiModelProperty + +/** + * A User who is purchasing from the pet store + * @param id + * @param username + * @param firstName + * @param lastName + * @param email + * @param password + * @param phone + * @param userStatus User Status + */ +data class User ( + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("id") val id: kotlin.Long? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("username") val username: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("firstName") val firstName: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("lastName") val lastName: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("email") val email: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("password") val password: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "") + @JsonProperty("phone") val phone: kotlin.String? = null, + + @ApiModelProperty(example = "null", value = "User Status") + @JsonProperty("userStatus") val userStatus: kotlin.Int? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/main/resources/application.yaml @@ -0,0 +1,10 @@ +spring: + application: + name: openAPIPetstore + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: 8080 diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt new file mode 100644 index 00000000000..f43c6ecf7ca --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -0,0 +1,150 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.junit.jupiter.api.Test + +import kotlinx.coroutines.flow.Flow; +import kotlinx.coroutines.test.runBlockingTest +import org.springframework.http.ResponseEntity + +class PetApiTest { + + private val service: PetApiService = PetApiServiceImpl() + private val api: PetApiController = PetApiController(service) + + + /** + * Add a new pet to the store + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun addPetTest() = runBlockingTest { + val body:Pet? = null + val response: ResponseEntity = api.addPet(body!!) + + // TODO: test validations + } + + /** + * Deletes a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deletePetTest() = runBlockingTest { + val petId:kotlin.Long? = null + val apiKey:kotlin.String? = null + val response: ResponseEntity = api.deletePet(petId!!, apiKey!!) + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun findPetsByStatusTest() = runBlockingTest { + val status:kotlin.collections.List? = null + val response: ResponseEntity> = api.findPetsByStatus(status!!) + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun findPetsByTagsTest() = runBlockingTest { + val tags:kotlin.collections.List? = null + val response: ResponseEntity> = api.findPetsByTags(tags!!) + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getPetByIdTest() = runBlockingTest { + val petId:kotlin.Long? = null + val response: ResponseEntity = api.getPetById(petId!!) + + // TODO: test validations + } + + /** + * Update an existing pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updatePetTest() = runBlockingTest { + val body:Pet? = null + val response: ResponseEntity = api.updatePet(body!!) + + // TODO: test validations + } + + /** + * Updates a pet in the store with form data + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updatePetWithFormTest() = runBlockingTest { + val petId:kotlin.Long? = null + val name:kotlin.String? = null + val status:kotlin.String? = null + val response: ResponseEntity = api.updatePetWithForm(petId!!, name!!, status!!) + + // TODO: test validations + } + + /** + * uploads an image + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun uploadFileTest() = runBlockingTest { + val petId:kotlin.Long? = null + val additionalMetadata:kotlin.String? = null + val file:org.springframework.core.io.Resource? = null + val response: ResponseEntity = api.uploadFile(petId!!, additionalMetadata!!, file!!) + + // TODO: test validations + } + +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt new file mode 100644 index 00000000000..31c0a2e0713 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -0,0 +1,79 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.junit.jupiter.api.Test + +import kotlinx.coroutines.flow.Flow; +import kotlinx.coroutines.test.runBlockingTest +import org.springframework.http.ResponseEntity + +class StoreApiTest { + + private val service: StoreApiService = StoreApiServiceImpl() + private val api: StoreApiController = StoreApiController(service) + + + /** + * Delete purchase order by ID + * + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deleteOrderTest() = runBlockingTest { + val orderId:kotlin.String? = null + val response: ResponseEntity = api.deleteOrder(orderId!!) + + // TODO: test validations + } + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getInventoryTest() = runBlockingTest { + val response: ResponseEntity> = api.getInventory() + + // TODO: test validations + } + + /** + * Find purchase order by ID + * + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getOrderByIdTest() = runBlockingTest { + val orderId:kotlin.Long? = null + val response: ResponseEntity = api.getOrderById(orderId!!) + + // TODO: test validations + } + + /** + * Place an order for a pet + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun placeOrderTest() = runBlockingTest { + val body:Order? = null + val response: ResponseEntity = api.placeOrder(body!!) + + // TODO: test validations + } + +} diff --git a/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt new file mode 100644 index 00000000000..3d467deb14f --- /dev/null +++ b/samples/server/petstore/kotlin-springboot-reactive/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -0,0 +1,145 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.junit.jupiter.api.Test + +import kotlinx.coroutines.flow.Flow; +import kotlinx.coroutines.test.runBlockingTest +import org.springframework.http.ResponseEntity + +class UserApiTest { + + private val service: UserApiService = UserApiServiceImpl() + private val api: UserApiController = UserApiController(service) + + + /** + * Create user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUserTest() = runBlockingTest { + val body:User? = null + val response: ResponseEntity = api.createUser(body!!) + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUsersWithArrayInputTest() = runBlockingTest { + val body:kotlin.collections.List? = null + val response: ResponseEntity = api.createUsersWithArrayInput(body!!) + + // TODO: test validations + } + + /** + * Creates list of users with given input array + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun createUsersWithListInputTest() = runBlockingTest { + val body:kotlin.collections.List? = null + val response: ResponseEntity = api.createUsersWithListInput(body!!) + + // TODO: test validations + } + + /** + * Delete user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun deleteUserTest() = runBlockingTest { + val username:kotlin.String? = null + val response: ResponseEntity = api.deleteUser(username!!) + + // TODO: test validations + } + + /** + * Get user by user name + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun getUserByNameTest() = runBlockingTest { + val username:kotlin.String? = null + val response: ResponseEntity = api.getUserByName(username!!) + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun loginUserTest() = runBlockingTest { + val username:kotlin.String? = null + val password:kotlin.String? = null + val response: ResponseEntity = api.loginUser(username!!, password!!) + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun logoutUserTest() = runBlockingTest { + val response: ResponseEntity = api.logoutUser() + + // TODO: test validations + } + + /** + * Updated user + * + * This can only be done by the logged in user. + * + * @throws ApiException + * if the Api call fails + */ + @Test + fun updateUserTest() = runBlockingTest { + val username:kotlin.String? = null + val body:User? = null + val response: ResponseEntity = api.updateUser(username!!, body!!) + + // TODO: test validations + } + +} diff --git a/samples/server/petstore/kotlin-springboot/build.gradle.kts b/samples/server/petstore/kotlin-springboot/build.gradle.kts index 29ca3edef7e..26f4601e570 100644 --- a/samples/server/petstore/kotlin-springboot/build.gradle.kts +++ b/samples/server/petstore/kotlin-springboot/build.gradle.kts @@ -6,7 +6,7 @@ buildscript { mavenCentral() } dependencies { - classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.2.0.M3") } } @@ -23,15 +23,16 @@ tasks.withType { } plugins { - val kotlinVersion = "1.2.60" + val kotlinVersion = "1.3.30" id("org.jetbrains.kotlin.jvm") version kotlinVersion id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion - id("org.springframework.boot") version "2.0.3.RELEASE" + id("org.springframework.boot") version "2.2.0.M3" id("io.spring.dependency-management") version "1.0.5.RELEASE" } dependencies { + val kotlinxCoroutinesVersion="1.2.0" compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") compile("org.jetbrains.kotlin:kotlin-reflect") compile("org.springframework.boot:spring-boot-starter-web") @@ -45,3 +46,9 @@ dependencies { exclude(module = "junit") } } + +repositories { + mavenCentral() + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } +} diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml index 71876ce723f..10720393bf0 100644 --- a/samples/server/petstore/kotlin-springboot/pom.xml +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -6,12 +6,13 @@ openapi-spring 1.0.0 - 1.2.60 + 1.3.30 + 1.2.0 org.springframework.boot spring-boot-starter-parent - 2.0.3.RELEASE + 2.2.0.M3 ${project.basedir}/src/main/kotlin @@ -79,6 +80,7 @@ org.springframework.boot spring-boot-starter-web + io.swagger swagger-annotations @@ -112,4 +114,34 @@ test + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + true + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + diff --git a/samples/server/petstore/kotlin-springboot/settings.gradle b/samples/server/petstore/kotlin-springboot/settings.gradle index f0dd035311e..e9bd5d32d7c 100644 --- a/samples/server/petstore/kotlin-springboot/settings.gradle +++ b/samples/server/petstore/kotlin-springboot/settings.gradle @@ -1 +1,15 @@ +pluginManagement { + repositories { + maven { url = uri("https://repo.spring.io/snapshot") } + maven { url = uri("https://repo.spring.io/milestone") } + gradlePluginPortal() + } + resolutionStrategy { + eachPlugin { + if (requested.id.id == "org.springframework.boot") { + useModule("org.springframework.boot:spring-boot-gradle-plugin:${requested.version}") + } + } + } +} rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt index 2f70853c857..6beea7c3bed 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -12,7 +12,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -36,7 +37,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Pet", description = "The Pet API") @RequestMapping("\${api.base-path:/v2}") @@ -55,7 +56,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { method = [RequestMethod.POST]) fun addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet ): ResponseEntity { - return ResponseEntity(service.addPet(body), HttpStatus.OK) + return ResponseEntity(service.addPet(body), HttpStatus.valueOf(405)) } @ApiOperation( @@ -68,10 +69,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { @RequestMapping( value = ["/pet/{petId}"], method = [RequestMethod.DELETE]) - fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long -,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String? + fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: kotlin.String? ): ResponseEntity { - return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.valueOf(400)) } @ApiOperation( @@ -87,9 +88,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByStatus"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: List + fun findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @Valid @RequestParam(value = "status", required = true) status: kotlin.collections.List ): ResponseEntity> { - return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.valueOf(200)) } @ApiOperation( @@ -105,9 +106,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/findByTags"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: List + fun findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) tags: kotlin.collections.List ): ResponseEntity> { - return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + return ResponseEntity(service.findPetsByTags(tags), HttpStatus.valueOf(200)) } @ApiOperation( @@ -122,9 +123,9 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long + fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: kotlin.Long ): ResponseEntity { - return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + return ResponseEntity(service.getPetById(petId), HttpStatus.valueOf(200)) } @ApiOperation( @@ -140,7 +141,7 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { method = [RequestMethod.PUT]) fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody body: Pet ): ResponseEntity { - return ResponseEntity(service.updatePet(body), HttpStatus.OK) + return ResponseEntity(service.updatePet(body), HttpStatus.valueOf(400)) } @ApiOperation( @@ -154,11 +155,11 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { value = ["/pet/{petId}"], consumes = ["application/x-www-form-urlencoded"], method = [RequestMethod.POST]) - fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long -,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: String? -,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: String? + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Updated name of the pet") @RequestParam(value="name", required=false) name: kotlin.String? +,@ApiParam(value = "Updated status of the pet") @RequestParam(value="status", required=false) status: kotlin.String? ): ResponseEntity { - return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.valueOf(405)) } @ApiOperation( @@ -174,10 +175,10 @@ class PetApiController(@Autowired(required = true) val service: PetApiService) { produces = ["application/json"], consumes = ["multipart/form-data"], method = [RequestMethod.POST]) - fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long -,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String? + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: kotlin.Long +,@ApiParam(value = "Additional data to pass to server") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: kotlin.String? ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: org.springframework.core.io.Resource? ): ResponseEntity { - return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt index 741a97d8603..f3f2fd68b6c 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -2,22 +2,21 @@ package org.openapitools.api import org.openapitools.model.ModelApiResponse import org.openapitools.model.Pet - interface PetApiService { - fun addPet(body: Pet): Unit + fun addPet(body: Pet): Unit - fun deletePet(petId: Long, apiKey: String?): Unit + fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit - fun findPetsByStatus(status: List): List + fun findPetsByStatus(status: kotlin.collections.List): List - fun findPetsByTags(tags: List): List + fun findPetsByTags(tags: kotlin.collections.List): List - fun getPetById(petId: Long): Pet + fun getPetById(petId: kotlin.Long): Pet - fun updatePet(body: Pet): Unit + fun updatePet(body: Pet): Unit - fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit + fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit - fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse + fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt index 5ecf2c91f33..452e4e400b7 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -10,19 +10,19 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun deletePet(petId: Long, apiKey: String?): Unit { + override fun deletePet(petId: kotlin.Long, apiKey: kotlin.String?): Unit { TODO("Implement me") } - override fun findPetsByStatus(status: List): List { + override fun findPetsByStatus(status: kotlin.collections.List): List { TODO("Implement me") } - override fun findPetsByTags(tags: List): List { + override fun findPetsByTags(tags: kotlin.collections.List): List { TODO("Implement me") } - override fun getPetById(petId: Long): Pet { + override fun getPetById(petId: kotlin.Long): Pet { TODO("Implement me") } @@ -30,11 +30,11 @@ class PetApiServiceImpl : PetApiService { TODO("Implement me") } - override fun updatePetWithForm(petId: Long, name: String?, status: String?): Unit { + override fun updatePetWithForm(petId: kotlin.Long, name: kotlin.String?, status: kotlin.String?): Unit { TODO("Implement me") } - override fun uploadFile(petId: Long, additionalMetadata: String?, file: org.springframework.core.io.Resource?): ModelApiResponse { + override fun uploadFile(petId: kotlin.Long, additionalMetadata: kotlin.String?, file: org.springframework.core.io.Resource?): ModelApiResponse { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt index ed467c5700e..a3ba066c21a 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -11,7 +11,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -35,7 +36,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "Store", description = "The Store API") @RequestMapping("\${api.base-path:/v2}") @@ -50,26 +51,26 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic @RequestMapping( value = ["/store/order/{orderId}"], method = [RequestMethod.DELETE]) - fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: String + fun deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted", required=true) @PathVariable("orderId") orderId: kotlin.String ): ResponseEntity { - return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.valueOf(400)) } @ApiOperation( value = "Returns pet inventories by status", nickname = "getInventory", notes = "Returns a map of status codes to quantities", - response = Int::class, + response = kotlin.Int::class, responseContainer = "Map", authorizations = [Authorization(value = "api_key")]) @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.collections.Map::class, responseContainer = "Map")]) @RequestMapping( value = ["/store/inventory"], produces = ["application/json"], method = [RequestMethod.GET]) - fun getInventory(): ResponseEntity> { - return ResponseEntity(service.getInventory(), HttpStatus.OK) + fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.valueOf(200)) } @ApiOperation( @@ -83,9 +84,9 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic value = ["/store/order/{orderId}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: kotlin.Long ): ResponseEntity { - return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + return ResponseEntity(service.getOrderById(orderId), HttpStatus.valueOf(200)) } @ApiOperation( @@ -101,6 +102,6 @@ class StoreApiController(@Autowired(required = true) val service: StoreApiServic method = [RequestMethod.POST]) fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody body: Order ): ResponseEntity { - return ResponseEntity(service.placeOrder(body), HttpStatus.OK) + return ResponseEntity(service.placeOrder(body), HttpStatus.valueOf(200)) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt index cf479e2c8a7..d4a4ef9507f 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -1,14 +1,13 @@ package org.openapitools.api import org.openapitools.model.Order - interface StoreApiService { - fun deleteOrder(orderId: String): Unit + fun deleteOrder(orderId: kotlin.String): Unit - fun getInventory(): Map + fun getInventory(): Map - fun getOrderById(orderId: Long): Order + fun getOrderById(orderId: kotlin.Long): Order - fun placeOrder(body: Order): Order + fun placeOrder(body: Order): Order } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt index f38e0eca525..7e733e28dc5 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -5,15 +5,15 @@ import org.springframework.stereotype.Service @Service class StoreApiServiceImpl : StoreApiService { - override fun deleteOrder(orderId: String): Unit { + override fun deleteOrder(orderId: kotlin.String): Unit { TODO("Implement me") } - override fun getInventory(): Map { + override fun getInventory(): Map { TODO("Implement me") } - override fun getOrderById(orderId: Long): Order { + override fun getOrderById(orderId: kotlin.Long): Order { TODO("Implement me") } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt index bab2a54b117..0a77ac8ecd8 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -11,7 +11,7 @@ import io.swagger.annotations.AuthorizationScope import org.springframework.http.HttpStatus import org.springframework.http.MediaType import org.springframework.http.ResponseEntity -import org.springframework.stereotype.Controller + import org.springframework.web.bind.annotation.RequestBody import org.springframework.web.bind.annotation.RequestPart import org.springframework.web.bind.annotation.RequestParam @@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PathVariable import org.springframework.web.bind.annotation.RequestHeader import org.springframework.web.bind.annotation.RequestMethod import org.springframework.web.bind.annotation.RequestMapping +import org.springframework.web.bind.annotation.RestController import org.springframework.validation.annotation.Validated import org.springframework.web.context.request.NativeWebRequest import org.springframework.beans.factory.annotation.Autowired @@ -35,7 +36,7 @@ import javax.validation.constraints.Size import kotlin.collections.List import kotlin.collections.Map -@Controller +@RestController @Validated @Api(value = "User", description = "The User API") @RequestMapping("\${api.base-path:/v2}") @@ -52,7 +53,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) method = [RequestMethod.POST]) fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody body: User ): ResponseEntity { - return ResponseEntity(service.createUser(body), HttpStatus.OK) + return ResponseEntity(service.createUser(body), HttpStatus.valueOf(200)) } @ApiOperation( @@ -64,9 +65,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithArray"], method = [RequestMethod.POST]) - fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List ): ResponseEntity { - return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.OK) + return ResponseEntity(service.createUsersWithArrayInput(body), HttpStatus.valueOf(200)) } @ApiOperation( @@ -78,9 +79,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/createWithList"], method = [RequestMethod.POST]) - fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: List + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody body: kotlin.collections.List ): ResponseEntity { - return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.OK) + return ResponseEntity(service.createUsersWithListInput(body), HttpStatus.valueOf(200)) } @ApiOperation( @@ -92,9 +93,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.DELETE]) - fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: String + fun deleteUser(@ApiParam(value = "The name that needs to be deleted", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { - return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + return ResponseEntity(service.deleteUser(username), HttpStatus.valueOf(400)) } @ApiOperation( @@ -108,26 +109,26 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/{username}"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: kotlin.String ): ResponseEntity { - return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + return ResponseEntity(service.getUserByName(username), HttpStatus.valueOf(200)) } @ApiOperation( value = "Logs user into the system", nickname = "loginUser", notes = "", - response = String::class) + response = kotlin.String::class) @ApiResponses( - value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + value = [ApiResponse(code = 200, message = "successful operation", response = kotlin.String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) @RequestMapping( value = ["/user/login"], produces = ["application/xml", "application/json"], method = [RequestMethod.GET]) - fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String -,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String -): ResponseEntity { - return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: kotlin.String +,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: kotlin.String +): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.valueOf(200)) } @ApiOperation( @@ -140,7 +141,7 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) value = ["/user/logout"], method = [RequestMethod.GET]) fun logoutUser(): ResponseEntity { - return ResponseEntity(service.logoutUser(), HttpStatus.OK) + return ResponseEntity(service.logoutUser(), HttpStatus.valueOf(200)) } @ApiOperation( @@ -152,9 +153,9 @@ class UserApiController(@Autowired(required = true) val service: UserApiService) @RequestMapping( value = ["/user/{username}"], method = [RequestMethod.PUT]) - fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String + fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: kotlin.String ,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody body: User ): ResponseEntity { - return ResponseEntity(service.updateUser(username, body), HttpStatus.OK) + return ResponseEntity(service.updateUser(username, body), HttpStatus.valueOf(400)) } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt index de61cf72c43..491705c3b50 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -1,22 +1,21 @@ package org.openapitools.api import org.openapitools.model.User - interface UserApiService { - fun createUser(body: User): Unit + fun createUser(body: User): Unit - fun createUsersWithArrayInput(body: List): Unit + fun createUsersWithArrayInput(body: kotlin.collections.List): Unit - fun createUsersWithListInput(body: List): Unit + fun createUsersWithListInput(body: kotlin.collections.List): Unit - fun deleteUser(username: String): Unit + fun deleteUser(username: kotlin.String): Unit - fun getUserByName(username: String): User + fun getUserByName(username: kotlin.String): User - fun loginUser(username: String, password: String): String + fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String - fun logoutUser(): Unit + fun logoutUser(): Unit - fun updateUser(username: String, body: User): Unit + fun updateUser(username: kotlin.String, body: User): Unit } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt index 3373dcb6a73..ebd82222015 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -9,23 +9,23 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun createUsersWithArrayInput(body: List): Unit { + override fun createUsersWithArrayInput(body: kotlin.collections.List): Unit { TODO("Implement me") } - override fun createUsersWithListInput(body: List): Unit { + override fun createUsersWithListInput(body: kotlin.collections.List): Unit { TODO("Implement me") } - override fun deleteUser(username: String): Unit { + override fun deleteUser(username: kotlin.String): Unit { TODO("Implement me") } - override fun getUserByName(username: String): User { + override fun getUserByName(username: kotlin.String): User { TODO("Implement me") } - override fun loginUser(username: String, password: String): String { + override fun loginUser(username: kotlin.String, password: kotlin.String): kotlin.String { TODO("Implement me") } @@ -33,7 +33,7 @@ class UserApiServiceImpl : UserApiService { TODO("Implement me") } - override fun updateUser(username: String, body: User): Unit { + override fun updateUser(username: kotlin.String, body: User): Unit { TODO("Implement me") } } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt index 1a1dbf7223c..f477eb4e7a8 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class Category ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("name") val name: String? = null + @JsonProperty("name") val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt index 2f844a9c356..0e86b28e937 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -20,13 +20,13 @@ import io.swagger.annotations.ApiModelProperty data class ModelApiResponse ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("code") val code: Int? = null, + @JsonProperty("code") val code: kotlin.Int? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("type") val type: String? = null, + @JsonProperty("type") val type: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("message") val message: String? = null + @JsonProperty("message") val message: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt index e20d850491f..08726893f7d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -24,13 +24,13 @@ import io.swagger.annotations.ApiModelProperty data class Order ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("petId") val petId: Long? = null, + @JsonProperty("petId") val petId: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("quantity") val quantity: Int? = null, + @JsonProperty("quantity") val quantity: kotlin.Int? = null, @ApiModelProperty(example = "null", value = "") @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, @@ -39,14 +39,14 @@ data class Order ( @JsonProperty("status") val status: Order.Status? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("complete") val complete: Boolean? = null + @JsonProperty("complete") val complete: kotlin.Boolean? = null ) { /** * Order Status * Values: placed,approved,delivered */ - enum class Status(val value: String) { + enum class Status(val value: kotlin.String) { @JsonProperty("placed") placed("placed"), diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt index 9e054ac22f7..4a2e9d26cb9 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -27,20 +27,20 @@ data class Pet ( @get:NotNull @ApiModelProperty(example = "doggie", required = true, value = "") - @JsonProperty("name") val name: String, + @JsonProperty("name") val name: kotlin.String, @get:NotNull @ApiModelProperty(example = "null", required = true, value = "") - @JsonProperty("photoUrls") val photoUrls: List, + @JsonProperty("photoUrls") val photoUrls: kotlin.collections.List, @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") @JsonProperty("category") val category: Category? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("tags") val tags: List? = null, + @JsonProperty("tags") val tags: kotlin.collections.List? = null, @ApiModelProperty(example = "null", value = "pet status in the store") @JsonProperty("status") val status: Pet.Status? = null @@ -50,7 +50,7 @@ data class Pet ( * pet status in the store * Values: available,pending,sold */ - enum class Status(val value: String) { + enum class Status(val value: kotlin.String) { @JsonProperty("available") available("available"), diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt index 40ef1b9a86b..df04dcd035d 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -19,10 +19,10 @@ import io.swagger.annotations.ApiModelProperty data class Tag ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("name") val name: String? = null + @JsonProperty("name") val name: kotlin.String? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt index 95fe12aa467..619b2e7c2c3 100644 --- a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -25,28 +25,28 @@ import io.swagger.annotations.ApiModelProperty data class User ( @ApiModelProperty(example = "null", value = "") - @JsonProperty("id") val id: Long? = null, + @JsonProperty("id") val id: kotlin.Long? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("username") val username: String? = null, + @JsonProperty("username") val username: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("firstName") val firstName: String? = null, + @JsonProperty("firstName") val firstName: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("lastName") val lastName: String? = null, + @JsonProperty("lastName") val lastName: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("email") val email: String? = null, + @JsonProperty("email") val email: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("password") val password: String? = null, + @JsonProperty("password") val password: kotlin.String? = null, @ApiModelProperty(example = "null", value = "") - @JsonProperty("phone") val phone: String? = null, + @JsonProperty("phone") val phone: kotlin.String? = null, @ApiModelProperty(example = "null", value = "User Status") - @JsonProperty("userStatus") val userStatus: Int? = null + @JsonProperty("userStatus") val userStatus: kotlin.Int? = null ) { } diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt index 394aff3b339..d621c166966 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/PetApiTest.kt @@ -38,8 +38,8 @@ class PetApiTest { */ @Test fun deletePetTest() { - val petId:Long? = null - val apiKey:String? = null + val petId:kotlin.Long? = null + val apiKey:kotlin.String? = null val response: ResponseEntity = api.deletePet(petId!!, apiKey!!) // TODO: test validations @@ -55,7 +55,7 @@ class PetApiTest { */ @Test fun findPetsByStatusTest() { - val status:List? = null + val status:kotlin.collections.List? = null val response: ResponseEntity> = api.findPetsByStatus(status!!) // TODO: test validations @@ -71,7 +71,7 @@ class PetApiTest { */ @Test fun findPetsByTagsTest() { - val tags:List? = null + val tags:kotlin.collections.List? = null val response: ResponseEntity> = api.findPetsByTags(tags!!) // TODO: test validations @@ -87,7 +87,7 @@ class PetApiTest { */ @Test fun getPetByIdTest() { - val petId:Long? = null + val petId:kotlin.Long? = null val response: ResponseEntity = api.getPetById(petId!!) // TODO: test validations @@ -119,9 +119,9 @@ class PetApiTest { */ @Test fun updatePetWithFormTest() { - val petId:Long? = null - val name:String? = null - val status:String? = null + val petId:kotlin.Long? = null + val name:kotlin.String? = null + val status:kotlin.String? = null val response: ResponseEntity = api.updatePetWithForm(petId!!, name!!, status!!) // TODO: test validations @@ -137,8 +137,8 @@ class PetApiTest { */ @Test fun uploadFileTest() { - val petId:Long? = null - val additionalMetadata:String? = null + val petId:kotlin.Long? = null + val additionalMetadata:kotlin.String? = null val file:org.springframework.core.io.Resource? = null val response: ResponseEntity = api.uploadFile(petId!!, additionalMetadata!!, file!!) diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt index 48b25c4eafd..82b91cd652b 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/StoreApiTest.kt @@ -21,7 +21,7 @@ class StoreApiTest { */ @Test fun deleteOrderTest() { - val orderId:String? = null + val orderId:kotlin.String? = null val response: ResponseEntity = api.deleteOrder(orderId!!) // TODO: test validations @@ -37,7 +37,7 @@ class StoreApiTest { */ @Test fun getInventoryTest() { - val response: ResponseEntity> = api.getInventory() + val response: ResponseEntity> = api.getInventory() // TODO: test validations } @@ -52,7 +52,7 @@ class StoreApiTest { */ @Test fun getOrderByIdTest() { - val orderId:Long? = null + val orderId:kotlin.Long? = null val response: ResponseEntity = api.getOrderById(orderId!!) // TODO: test validations diff --git a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt index 50940559e87..14917f70aeb 100644 --- a/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt +++ b/samples/server/petstore/kotlin-springboot/src/test/kotlin/org/openapitools/api/UserApiTest.kt @@ -37,7 +37,7 @@ class UserApiTest { */ @Test fun createUsersWithArrayInputTest() { - val body:List? = null + val body:kotlin.collections.List? = null val response: ResponseEntity = api.createUsersWithArrayInput(body!!) // TODO: test validations @@ -53,7 +53,7 @@ class UserApiTest { */ @Test fun createUsersWithListInputTest() { - val body:List? = null + val body:kotlin.collections.List? = null val response: ResponseEntity = api.createUsersWithListInput(body!!) // TODO: test validations @@ -69,7 +69,7 @@ class UserApiTest { */ @Test fun deleteUserTest() { - val username:String? = null + val username:kotlin.String? = null val response: ResponseEntity = api.deleteUser(username!!) // TODO: test validations @@ -85,7 +85,7 @@ class UserApiTest { */ @Test fun getUserByNameTest() { - val username:String? = null + val username:kotlin.String? = null val response: ResponseEntity = api.getUserByName(username!!) // TODO: test validations @@ -101,9 +101,9 @@ class UserApiTest { */ @Test fun loginUserTest() { - val username:String? = null - val password:String? = null - val response: ResponseEntity = api.loginUser(username!!, password!!) + val username:kotlin.String? = null + val password:kotlin.String? = null + val response: ResponseEntity = api.loginUser(username!!, password!!) // TODO: test validations } @@ -133,7 +133,7 @@ class UserApiTest { */ @Test fun updateUserTest() { - val username:String? = null + val username:kotlin.String? = null val body:User? = null val response: ResponseEntity = api.updateUser(username!!, body!!) diff --git a/samples/server/petstore/nodejs-google-cloud-functions/.openapi-generator/VERSION b/samples/server/petstore/nodejs-google-cloud-functions/.openapi-generator/VERSION index 096bf47efe3..d96260ba335 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/.openapi-generator/VERSION +++ b/samples/server/petstore/nodejs-google-cloud-functions/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/nodejs-google-cloud-functions/api/openapi.yaml b/samples/server/petstore/nodejs-google-cloud-functions/api/openapi.yaml index 8a31b8d5b86..f2908efadee 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/api/openapi.yaml +++ b/samples/server/petstore/nodejs-google-cloud-functions/api/openapi.yaml @@ -1,178 +1,198 @@ -openapi: 3.0.1 +openapi: 3.0.0 info: - title: OpenAPI Petstore - description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io servers: - url: http://petstore.swagger.io/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user paths: /pet: - put: - tags: - - pet - summary: Update an existing pet - operationId: updatePet - requestBody: - description: Pet object that needs to be added to the store - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - required: true - responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Pet not found - content: {} - 405: - description: Validation exception - content: {} - security: - - petstore_auth: - - write:pets - - read:pets - x-openapi-router-controller: Pet post: - tags: - - pet - summary: Add a new pet to the store operationId: addPet requestBody: - description: Pet object that needs to be added to the store - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - required: true + $ref: '#/components/requestBodies/Pet' responses: 405: description: Invalid input - content: {} security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: Pet - /pet/findByStatus: - get: + summary: Add a new pet to the store tags: - pet - summary: Finds Pets by status + x-swagger-router-controller: Pet + put: + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + 400: + description: Invalid ID supplied + 404: + description: Pet not found + 405: + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-swagger-router-controller: Pet + /pet/findByStatus: + get: description: Multiple status values can be provided with comma separated strings operationId: findPetsByStatus parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true + - description: Status values that need to be considered for filter explode: false + in: query + name: status + required: true schema: - type: array items: - type: string default: available enum: - available - pending - sold + type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: description: Invalid status value - content: {} security: - petstore_auth: - - write:pets - read:pets - x-openapi-router-controller: Pet - /pet/findByTags: - get: + summary: Finds Pets by status tags: - pet - summary: Finds Pets by tags - description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + x-swagger-router-controller: Pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - - name: tags - in: query - description: Tags to filter by - required: true + - description: Tags to filter by explode: false + in: query + name: tags + required: true schema: - type: array items: type: string + type: array + style: form + - description: Maximum number of items to return + explode: true + in: query + name: maxCount + required: false + schema: + format: int32 + type: integer + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: description: Invalid tag value - content: {} - deprecated: true + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-swagger-router-controller: Pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + 400: + description: Invalid pet value security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: Pet - /pet/{petId}: - get: + summary: Deletes a pet tags: - pet - summary: Find pet by ID + x-swagger-router-controller: Pet + get: description: Returns a single pet operationId: getPetById parameters: - - name: petId + - description: ID of pet to return + explode: false in: path - description: ID of pet to return + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -180,148 +200,127 @@ paths: application/json: schema: $ref: '#/components/schemas/Pet' + description: successful operation 400: description: Invalid ID supplied - content: {} 404: description: Pet not found - content: {} security: - api_key: [] - x-openapi-router-controller: Pet - post: + summary: Find pet by ID tags: - pet - summary: Updates a pet in the store with form data + x-swagger-router-controller: Pet + post: operationId: updatePetWithForm parameters: - - name: petId + - description: ID of pet that needs to be updated + explode: false in: path - description: ID of pet that needs to be updated + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object' content: application/x-www-form-urlencoded: schema: properties: name: - type: string description: Updated name of the pet - status: type: string + status: description: Updated status of the pet + type: string + type: object responses: 405: description: Invalid input - content: {} security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: Pet - delete: + summary: Updates a pet in the store with form data tags: - pet - summary: Deletes a pet - operationId: deletePet - parameters: - - name: api_key - in: header - schema: - type: string - - name: petId - in: path - description: Pet id to delete - required: true - schema: - type: integer - format: int64 - responses: - 400: - description: Invalid pet value - content: {} - security: - - petstore_auth: - - write:pets - - read:pets - x-openapi-router-controller: Pet + x-swagger-router-controller: Pet /pet/{petId}/uploadImage: post: - tags: - - pet - summary: uploads an image operationId: uploadFile parameters: - - name: petId + - description: ID of pet to update + explode: false in: path - description: ID of pet to update + name: petId required: true schema: - type: integer format: int64 + type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_1' content: multipart/form-data: schema: properties: additionalMetadata: - type: string description: Additional data to pass to server - file: type: string + file: description: file to upload format: binary + type: string + type: object responses: 200: - description: successful operation content: application/json: schema: $ref: '#/components/schemas/ApiResponse' + description: successful operation security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: Pet + summary: uploads an image + tags: + - pet + x-swagger-router-controller: Pet /store/inventory: get: - tags: - - store - summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: getInventory responses: 200: - description: successful operation content: application/json: schema: - type: object additionalProperties: - type: integer format: int32 + type: integer + type: object + description: successful operation security: - api_key: [] - x-openapi-router-controller: Store - /store/order: - post: + summary: Returns pet inventories by status tags: - store - summary: Place an order for a pet + x-swagger-router-controller: Store + /store/order: + post: operationId: placeOrder requestBody: - description: order placed for purchasing the pet content: - '*/*': + application/json: schema: $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet required: true responses: 200: - description: successful operation content: application/xml: schema: @@ -329,30 +328,54 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: description: Invalid Order - content: {} - x-openapi-router-controller: Store - /store/order/{orderId}: - get: + summary: Place an order for a pet tags: - store - summary: Find purchase order by ID - description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - operationId: getOrderById + x-swagger-router-controller: Store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder parameters: - - name: orderId + - description: ID of the order that needs to be deleted + explode: false in: path - description: ID of pet that needs to be fetched + name: orderId required: true schema: + type: string + style: simple + responses: + 400: + description: Invalid ID supplied + 404: + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-swagger-router-controller: Store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 maximum: 5 minimum: 1 type: integer - format: int64 + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -360,126 +383,86 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: description: Invalid ID supplied - content: {} 404: description: Order not found - content: {} - x-openapi-router-controller: Store - delete: + summary: Find purchase order by ID tags: - store - summary: Delete purchase order by ID - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - operationId: deleteOrder - parameters: - - name: orderId - in: path - description: ID of the order that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid ID supplied - content: {} - 404: - description: Order not found - content: {} - x-openapi-router-controller: Store + x-swagger-router-controller: Store /user: post: - tags: - - user - summary: Create user description: This can only be done by the logged in user. operationId: createUser requestBody: - description: Created user object content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' + description: Created user object required: true responses: default: description: successful operation - content: {} - x-openapi-router-controller: User + security: + - auth_cookie: [] + summary: Create user + tags: + - user + x-swagger-router-controller: User /user/createWithArray: post: - tags: - - user - summary: Creates list of users with given input array operationId: createUsersWithArrayInput requestBody: - description: List of user object - content: - '*/*': - schema: - type: array - items: - $ref: '#/components/schemas/User' - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: description: successful operation - content: {} - x-openapi-router-controller: User + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + x-swagger-router-controller: User /user/createWithList: post: - tags: - - user - summary: Creates list of users with given input array operationId: createUsersWithListInput requestBody: - description: List of user object - content: - '*/*': - schema: - type: array - items: - $ref: '#/components/schemas/User' - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: description: successful operation - content: {} - x-openapi-router-controller: User - /user/login: - get: + security: + - auth_cookie: [] + summary: Creates list of users with given input array tags: - user - summary: Logs user into the system + x-swagger-router-controller: User + /user/login: + get: operationId: loginUser parameters: - - name: username + - description: The user name for login + explode: true in: query - description: The user name for login - required: true - schema: - type: string - - name: password - in: query - description: The password for login in clear text + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password required: true schema: type: string + style: form responses: 200: - description: successful operation - headers: - X-Rate-Limit: - description: calls per hour allowed by the user - schema: - type: integer - format: int32 - X-Expires-After: - description: date in UTC when toekn expires - schema: - type: string - format: date-time content: application/xml: schema: @@ -487,37 +470,85 @@ paths: application/json: schema: type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + X-Expires-After: + description: date in UTC when toekn expires + explode: false + schema: + format: date-time + type: string + style: simple 400: description: Invalid username/password supplied - content: {} - x-openapi-router-controller: User - /user/logout: - get: + summary: Logs user into the system tags: - user - summary: Logs out current logged in user session + x-swagger-router-controller: User + /user/logout: + get: operationId: logoutUser responses: default: description: successful operation - content: {} - x-openapi-router-controller: User - /user/{username}: - get: + security: + - auth_cookie: [] + summary: Logs out current logged in user session tags: - user - summary: Get user by user name - operationId: getUserByName + x-swagger-router-controller: User + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser parameters: - - name: username + - description: The name that needs to be deleted + explode: false in: path - description: The name that needs to be fetched. Use user1 for testing. + name: username required: true schema: type: string + style: simple + responses: + 400: + description: Invalid username supplied + 404: + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + x-swagger-router-controller: User + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple responses: 200: - description: successful operation content: application/xml: schema: @@ -525,90 +556,78 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + description: successful operation 400: description: Invalid username supplied - content: {} 404: description: User not found - content: {} - x-openapi-router-controller: User - put: + summary: Get user by user name tags: - user - summary: Updated user + x-swagger-router-controller: User + put: description: This can only be done by the logged in user. operationId: updateUser parameters: - - name: username + - description: name that need to be deleted + explode: false in: path - description: name that need to be deleted + name: username required: true schema: type: string + style: simple requestBody: - description: Updated user object content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' + description: Updated user object required: true responses: 400: description: Invalid user supplied - content: {} 404: description: User not found - content: {} - x-openapi-router-controller: User - delete: + security: + - auth_cookie: [] + summary: Updated user tags: - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: deleteUser - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - schema: - type: string - responses: - 400: - description: Invalid username supplied - content: {} - 404: - description: User not found - content: {} - x-openapi-router-controller: User + x-swagger-router-controller: User components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' schemas: Order: - title: Pet Order - type: object - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: - type: integer - format: int32 - shipDate: - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - default: false description: An order for a pets from the pet store example: petId: 6 @@ -617,30 +636,64 @@ components: shipDate: 2000-01-23T04:56:07.000+00:00 complete: false status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object xml: name: Order Category: - title: Pet category - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A category for a pet example: name: name id: 6 + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object xml: name: Category User: - title: a User - type: object + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username properties: id: - type: integer format: int64 + type: integer username: type: string firstName: @@ -654,72 +707,29 @@ components: phone: type: string userStatus: - type: integer description: User Status format: int32 - description: A User who is purchasing from the pet store - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username + type: integer + title: a User + type: object xml: name: User Tag: - title: Pet Tag - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A tag for a pet example: name: name id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object xml: name: Tag Pet: - title: a Pet - required: - - name - - photoUrls - type: object - properties: - id: - type: integer - format: int64 - category: - $ref: '#/components/schemas/Category' - name: - type: string - example: doggie - photoUrls: - type: array - xml: - name: photoUrl - wrapped: true - items: - type: string - tags: - type: array - xml: - name: tag - wrapped: true - items: - $ref: '#/components/schemas/Tag' - status: - type: string - description: pet status in the store - enum: - - available - - pending - - sold description: A pet for sale in the pet store example: photoUrls: @@ -736,34 +746,92 @@ components: - name: name id: 1 status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object xml: name: Pet ApiResponse: - title: An uploaded response - type: object - properties: - code: - type: integer - format: int32 - type: - type: string - message: - type: string description: Describes the result of uploading an image resource example: code: 0 type: type message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets + type: oauth2 api_key: - type: apiKey - name: api_key in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey diff --git a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js index 53d029ce27c..14a5573b642 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/controllers/Pet.js @@ -16,8 +16,8 @@ module.exports.addPet = function addPet (req, res, next) { module.exports.deletePet = function deletePet (req, res, next) { var petId = req.swagger.params['petId'].value; - var api_key = req.swagger.params['api_key'].value; - Pet.deletePet(petId,api_key) + var apiUnderscorekey = req.swagger.params['api_key'].value; + Pet.deletePet(petId,apiUnderscorekey) .then(function (response) { utils.writeJson(res, response); }) @@ -39,7 +39,8 @@ module.exports.findPetsByStatus = function findPetsByStatus (req, res, next) { module.exports.findPetsByTags = function findPetsByTags (req, res, next) { var tags = req.swagger.params['tags'].value; - Pet.findPetsByTags(tags) + var maxCount = req.swagger.params['maxCount'].value; + Pet.findPetsByTags(tags,maxCount) .then(function (response) { utils.writeJson(res, response); }) diff --git a/samples/server/petstore/nodejs-google-cloud-functions/service/PetService.js b/samples/server/petstore/nodejs-google-cloud-functions/service/PetService.js index e4a0219ab80..441e248b271 100644 --- a/samples/server/petstore/nodejs-google-cloud-functions/service/PetService.js +++ b/samples/server/petstore/nodejs-google-cloud-functions/service/PetService.js @@ -18,10 +18,10 @@ exports.addPet = function(pet) { * Deletes a pet * * petId Long Pet id to delete - * api_key String (optional) + * apiUnderscorekey String (optional) * no response value expected for this operation **/ -exports.deletePet = function(petId,api_key) { +exports.deletePet = function(petId,apiUnderscorekey) { return new Promise(function(resolve, reject) { resolve(); }); @@ -69,9 +69,10 @@ exports.findPetsByStatus = function(status) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * tags List Tags to filter by + * maxCount Integer Maximum number of items to return (optional) * returns List **/ -exports.findPetsByTags = function(tags) { +exports.findPetsByTags = function(tags,maxCount) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { diff --git a/samples/server/petstore/nodejs/.openapi-generator/VERSION b/samples/server/petstore/nodejs/.openapi-generator/VERSION index 0628777500b..d96260ba335 100644 --- a/samples/server/petstore/nodejs/.openapi-generator/VERSION +++ b/samples/server/petstore/nodejs/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.0-SNAPSHOT \ No newline at end of file +4.0.2-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/nodejs/api/openapi.yaml b/samples/server/petstore/nodejs/api/openapi.yaml index 877989080ca..f2908efadee 100644 --- a/samples/server/petstore/nodejs/api/openapi.yaml +++ b/samples/server/petstore/nodejs/api/openapi.yaml @@ -1,11 +1,15 @@ -openapi: 3.0.1 +openapi: 3.0.0 info: - description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html title: OpenAPI Petstore version: 1.0.0 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io servers: - url: http://petstore.swagger.io/v2 tags: @@ -20,18 +24,9 @@ paths: post: operationId: addPet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: 405: - content: {} description: Invalid input security: - petstore_auth: @@ -44,24 +39,13 @@ paths: put: operationId: updatePet requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - description: Pet object that needs to be added to the store - required: true + $ref: '#/components/requestBodies/Pet' responses: 400: - content: {} description: Invalid ID supplied 404: - content: {} description: Pet not found 405: - content: {} description: Validation exception security: - petstore_auth: @@ -106,11 +90,9 @@ paths: type: array description: successful operation 400: - content: {} description: Invalid status value security: - petstore_auth: - - write:pets - read:pets summary: Finds Pets by status tags: @@ -119,7 +101,8 @@ paths: /pet/findByTags: get: deprecated: true - description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. operationId: findPetsByTags parameters: - description: Tags to filter by @@ -132,6 +115,15 @@ paths: type: string type: array style: form + - description: Maximum number of items to return + explode: true + in: query + name: maxCount + required: false + schema: + format: int32 + type: integer + style: form responses: 200: content: @@ -147,11 +139,9 @@ paths: type: array description: successful operation 400: - content: {} description: Invalid tag value security: - petstore_auth: - - write:pets - read:pets summary: Finds Pets by tags tags: @@ -161,20 +151,24 @@ paths: delete: operationId: deletePet parameters: - - in: header + - explode: false + in: header name: api_key + required: false schema: type: string + style: simple - description: Pet id to delete + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: 400: - content: {} description: Invalid pet value security: - petstore_auth: @@ -189,12 +183,14 @@ paths: operationId: getPetById parameters: - description: ID of pet to return + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple responses: 200: content: @@ -206,10 +202,8 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation 400: - content: {} description: Invalid ID supplied 404: - content: {} description: Pet not found security: - api_key: [] @@ -221,13 +215,16 @@ paths: operationId: updatePetWithForm parameters: - description: ID of pet that needs to be updated + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object' content: application/x-www-form-urlencoded: schema: @@ -238,9 +235,9 @@ paths: status: description: Updated status of the pet type: string + type: object responses: 405: - content: {} description: Invalid input security: - petstore_auth: @@ -255,13 +252,16 @@ paths: operationId: uploadFile parameters: - description: ID of pet to update + explode: false in: path name: petId required: true schema: format: int64 type: integer + style: simple requestBody: + $ref: '#/components/requestBodies/inline_object_1' content: multipart/form-data: schema: @@ -273,6 +273,7 @@ paths: description: file to upload format: binary type: string + type: object responses: 200: content: @@ -313,7 +314,7 @@ paths: operationId: placeOrder requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -329,7 +330,6 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: - content: {} description: Invalid Order summary: Place an order for a pet tags: @@ -337,31 +337,34 @@ paths: x-swagger-router-controller: Store /store/order/{orderId}: delete: - description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted + explode: false in: path name: orderId required: true schema: type: string + style: simple responses: 400: - content: {} description: Invalid ID supplied 404: - content: {} description: Order not found summary: Delete purchase order by ID tags: - store x-swagger-router-controller: Store get: - description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generated exceptions operationId: getOrderById parameters: - description: ID of pet that needs to be fetched + explode: false in: path name: orderId required: true @@ -370,6 +373,7 @@ paths: maximum: 5 minimum: 1 type: integer + style: simple responses: 200: content: @@ -381,10 +385,8 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: - content: {} description: Invalid ID supplied 404: - content: {} description: Order not found summary: Find purchase order by ID tags: @@ -396,15 +398,16 @@ paths: operationId: createUser requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: - content: {} description: successful operation + security: + - auth_cookie: [] summary: Create user tags: - user @@ -413,18 +416,12 @@ paths: post: operationId: createUsersWithArrayInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation + security: + - auth_cookie: [] summary: Creates list of users with given input array tags: - user @@ -433,18 +430,12 @@ paths: post: operationId: createUsersWithListInput requestBody: - content: - '*/*': - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true + $ref: '#/components/requestBodies/UserArray' responses: default: - content: {} description: successful operation + security: + - auth_cookie: [] summary: Creates list of users with given input array tags: - user @@ -454,17 +445,22 @@ paths: operationId: loginUser parameters: - description: The user name for login + explode: true in: query name: username required: true schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ type: string + style: form - description: The password for login in clear text + explode: true in: query name: password required: true schema: type: string + style: form responses: 200: content: @@ -476,18 +472,29 @@ paths: type: string description: successful operation headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple X-Rate-Limit: description: calls per hour allowed by the user + explode: false schema: format: int32 type: integer + style: simple X-Expires-After: description: date in UTC when toekn expires + explode: false schema: format: date-time type: string + style: simple 400: - content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -498,8 +505,9 @@ paths: operationId: logoutUser responses: default: - content: {} description: successful operation + security: + - auth_cookie: [] summary: Logs out current logged in user session tags: - user @@ -510,18 +518,20 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple responses: 400: - content: {} description: Invalid username supplied 404: - content: {} description: User not found + security: + - auth_cookie: [] summary: Delete user tags: - user @@ -530,11 +540,13 @@ paths: operationId: getUserByName parameters: - description: The name that needs to be fetched. Use user1 for testing. + explode: false in: path name: username required: true schema: type: string + style: simple responses: 200: content: @@ -546,10 +558,8 @@ paths: $ref: '#/components/schemas/User' description: successful operation 400: - content: {} description: Invalid username supplied 404: - content: {} description: User not found summary: Get user by user name tags: @@ -560,30 +570,62 @@ paths: operationId: updateUser parameters: - description: name that need to be deleted + explode: false in: path name: username required: true schema: type: string + style: simple requestBody: content: - '*/*': + application/json: schema: $ref: '#/components/schemas/User' description: Updated user object required: true responses: 400: - content: {} description: Invalid user supplied 404: - content: {} description: User not found + security: + - auth_cookie: [] summary: Updated user tags: - user x-swagger-router-controller: User components: + requestBodies: + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' schemas: Order: description: An order for a pets from the pet store @@ -631,6 +673,7 @@ components: format: int64 type: integer name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ type: string title: Pet category type: object @@ -756,6 +799,25 @@ components: type: string title: An uploaded response type: object + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object securitySchemes: petstore_auth: flows: @@ -769,3 +831,7 @@ components: in: header name: api_key type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey diff --git a/samples/server/petstore/nodejs/controllers/Pet.js b/samples/server/petstore/nodejs/controllers/Pet.js index 53d029ce27c..14a5573b642 100644 --- a/samples/server/petstore/nodejs/controllers/Pet.js +++ b/samples/server/petstore/nodejs/controllers/Pet.js @@ -16,8 +16,8 @@ module.exports.addPet = function addPet (req, res, next) { module.exports.deletePet = function deletePet (req, res, next) { var petId = req.swagger.params['petId'].value; - var api_key = req.swagger.params['api_key'].value; - Pet.deletePet(petId,api_key) + var apiUnderscorekey = req.swagger.params['api_key'].value; + Pet.deletePet(petId,apiUnderscorekey) .then(function (response) { utils.writeJson(res, response); }) @@ -39,7 +39,8 @@ module.exports.findPetsByStatus = function findPetsByStatus (req, res, next) { module.exports.findPetsByTags = function findPetsByTags (req, res, next) { var tags = req.swagger.params['tags'].value; - Pet.findPetsByTags(tags) + var maxCount = req.swagger.params['maxCount'].value; + Pet.findPetsByTags(tags,maxCount) .then(function (response) { utils.writeJson(res, response); }) diff --git a/samples/server/petstore/nodejs/service/PetService.js b/samples/server/petstore/nodejs/service/PetService.js index e4a0219ab80..441e248b271 100644 --- a/samples/server/petstore/nodejs/service/PetService.js +++ b/samples/server/petstore/nodejs/service/PetService.js @@ -18,10 +18,10 @@ exports.addPet = function(pet) { * Deletes a pet * * petId Long Pet id to delete - * api_key String (optional) + * apiUnderscorekey String (optional) * no response value expected for this operation **/ -exports.deletePet = function(petId,api_key) { +exports.deletePet = function(petId,apiUnderscorekey) { return new Promise(function(resolve, reject) { resolve(); }); @@ -69,9 +69,10 @@ exports.findPetsByStatus = function(status) { * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * * tags List Tags to filter by + * maxCount Integer Maximum number of items to return (optional) * returns List **/ -exports.findPetsByTags = function(tags) { +exports.findPetsByTags = function(tags,maxCount) { return new Promise(function(resolve, reject) { var examples = {}; examples['application/json'] = { diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore b/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore deleted file mode 100644 index 20b7b989760..00000000000 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/.gitignore +++ /dev/null @@ -1,54 +0,0 @@ -# ref: https://github.com/github/gitignore/blob/master/Symfony.gitignore - -# Cache and logs (Symfony2) -/app/cache/* -/app/logs/* -!app/cache/.gitkeep -!app/logs/.gitkeep - -# Email spool folder -/app/spool/* - -# Cache, session files and logs (Symfony3) -/var/cache/* -/var/logs/* -/var/sessions/* -!var/cache/.gitkeep -!var/logs/.gitkeep -!var/sessions/.gitkeep - -# Parameters -/app/config/parameters.yml -/app/config/parameters.ini - -# Managed by Composer -/app/bootstrap.php.cache -/var/bootstrap.php.cache -/bin/* -!bin/console -!bin/symfony_requirements -/vendor/ - -# Assets and user uploads -/web/bundles/ -/web/uploads/ - -# PHPUnit -/app/phpunit.xml -/phpunit.xml - -# Build data -/build/ - -# Composer PHAR -/composer.phar - -# Backup entities generated with doctrine:generate:entities command -**/Entity/*~ - -# Embedded web-server pid file -/.web-server-pid - -# From root gitignore -/Tests/cache/ -/Tests/logs/ \ No newline at end of file diff --git a/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md b/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md index b0b43a35b5d..571e9dcbf29 100644 --- a/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md +++ b/samples/server/petstore/php-symfony/SymfonyBundle-php/Resources/docs/Api/UserApiInterface.md @@ -115,7 +115,7 @@ class UserApi implements UserApiInterface Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OpenAPI\Server\Model\User**](../Model/array.md)| List of user object | + **body** | [**OpenAPI\Server\Model\User**](../Model/User.md)| List of user object | ### Return type @@ -167,7 +167,7 @@ class UserApi implements UserApiInterface Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**OpenAPI\Server\Model\User**](../Model/array.md)| List of user object | + **body** | [**OpenAPI\Server\Model\User**](../Model/User.md)| List of user object | ### Return type diff --git a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md index 0ec3e5c9f1f..b8652374c9d 100644 --- a/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md +++ b/samples/server/petstore/rust-server/output/openapi-v3/docs/default_api.md @@ -116,7 +116,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **string** | [**array**](array.md)| | + **string** | [**string**](string.md)| | ### Return type @@ -148,7 +148,7 @@ Optional parameters are passed through a map[string]interface{}. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **string** | [**array**](array.md)| | + **string** | [**string**](string.md)| | ### Return type diff --git a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md index 9698e5b23d9..908faa76175 100644 --- a/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md +++ b/samples/server/petstore/rust-server/output/petstore-with-fake-endpoints-models-for-testing/docs/user_api.md @@ -49,7 +49,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**array**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type @@ -74,7 +74,7 @@ Creates list of users with given input array Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**array**](array.md)| List of user object | + **body** | [**User**](User.md)| List of user object | ### Return type diff --git a/samples/server/petstore/scala-play-server/app/api/ApiDocController.scala b/samples/server/petstore/scala-play-server/app/api/ApiDocController.scala index c86ec2b87b9..27ff50a810c 100644 --- a/samples/server/petstore/scala-play-server/app/api/ApiDocController.scala +++ b/samples/server/petstore/scala-play-server/app/api/ApiDocController.scala @@ -6,6 +6,6 @@ import play.api.mvc._ @Singleton class ApiDocController @Inject()(cc: ControllerComponents) extends AbstractController(cc) { def api: Action[AnyContent] = Action { - Redirect("/assets/lib/swagger-ui/index.html?/url=/assets/openapi.json") + Redirect("/assets/lib/swagger-ui/index.html?url=/assets/openapi.json") } } diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index 7c74b1f294a..6b564dea71c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -95,6 +95,16 @@ spring-web ${spring-version} + + javax.annotation + javax.annotation-api + 1.3.2 + + + javax.xml.bind + jaxb-api + 2.2.11 + io.springfox diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml index 92fd248964d..9b3b1f7bdcf 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/pom.xml @@ -95,6 +95,16 @@ spring-web ${spring-version} + + javax.annotation + javax.annotation-api + 1.3.2 + + + javax.xml.bind + jaxb-api + 2.2.11 + io.springfox diff --git a/samples/server/petstore/spring-mvc/pom.xml b/samples/server/petstore/spring-mvc/pom.xml index adcf1f57683..d5e6f655d79 100644 --- a/samples/server/petstore/spring-mvc/pom.xml +++ b/samples/server/petstore/spring-mvc/pom.xml @@ -95,6 +95,16 @@ spring-web ${spring-version} + + javax.annotation + javax.annotation-api + 1.3.2 + + + javax.xml.bind + jaxb-api + 2.2.11 + io.springfox diff --git a/samples/server/petstore/springboot-beanvalidation/pom.xml b/samples/server/petstore/springboot-beanvalidation/pom.xml index 053b3d33f09..6536e609c6c 100644 --- a/samples/server/petstore/springboot-beanvalidation/pom.xml +++ b/samples/server/petstore/springboot-beanvalidation/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.github.joschi.jackson jackson-datatype-threetenbp diff --git a/samples/server/petstore/springboot-delegate-j8/pom.xml b/samples/server/petstore/springboot-delegate-j8/pom.xml index 4c26499044e..b3b8c885f0d 100644 --- a/samples/server/petstore/springboot-delegate-j8/pom.xml +++ b/samples/server/petstore/springboot-delegate-j8/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-delegate/pom.xml b/samples/server/petstore/springboot-delegate/pom.xml index cefb505c3c6..83b61b77934 100644 --- a/samples/server/petstore/springboot-delegate/pom.xml +++ b/samples/server/petstore/springboot-delegate/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.github.joschi.jackson jackson-datatype-threetenbp diff --git a/samples/server/petstore/springboot-implicitHeaders/pom.xml b/samples/server/petstore/springboot-implicitHeaders/pom.xml index 987710c5de5..320db0c02a0 100644 --- a/samples/server/petstore/springboot-implicitHeaders/pom.xml +++ b/samples/server/petstore/springboot-implicitHeaders/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java index 76cb1fb00a9..4a975b1efc2 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApi.java @@ -50,7 +50,7 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithArray", method = RequestMethod.POST) - default Mono> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { + default Mono> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { return getDelegate().createUsersWithArrayInput(body, exchange); } @@ -60,7 +60,7 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithList", method = RequestMethod.POST) - default Mono> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { + default Mono> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux body, ServerWebExchange exchange) { return getDelegate().createUsersWithListInput(body, exchange); } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java index a56614beabd..156ba16a769 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -41,7 +41,7 @@ public interface UserApiDelegate { /** * @see UserApi#createUsersWithArrayInput */ - default Mono> createUsersWithArrayInput(Flux body, + default Mono> createUsersWithArrayInput(Flux body, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); @@ -52,7 +52,7 @@ public interface UserApiDelegate { /** * @see UserApi#createUsersWithListInput */ - default Mono> createUsersWithListInput(Flux body, + default Mono> createUsersWithListInput(Flux body, ServerWebExchange exchange) { Mono result = Mono.empty(); exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index 8cf0da5c953..67ecc530a56 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1736,8 +1736,6 @@ components: type: object type: object List: - example: - 123-list: 123-list properties: 123-list: type: string diff --git a/samples/server/petstore/springboot-useoptional/pom.xml b/samples/server/petstore/springboot-useoptional/pom.xml index fb5ac072dcb..76bec66a453 100644 --- a/samples/server/petstore/springboot-useoptional/pom.xml +++ b/samples/server/petstore/springboot-useoptional/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot-virtualan/pom.xml b/samples/server/petstore/springboot-virtualan/pom.xml index 220257f505d..809f9c1f9aa 100644 --- a/samples/server/petstore/springboot-virtualan/pom.xml +++ b/samples/server/petstore/springboot-virtualan/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/samples/server/petstore/springboot/pom.xml b/samples/server/petstore/springboot/pom.xml index 5ff1f68b561..d4227500a1d 100644 --- a/samples/server/petstore/springboot/pom.xml +++ b/samples/server/petstore/springboot/pom.xml @@ -48,6 +48,11 @@ springfox-swagger-ui ${springfox-version} + + javax.xml.bind + jaxb-api + 2.2.11 + com.fasterxml.jackson.datatype jackson-datatype-jsr310 diff --git a/shippable.yml b/shippable.yml index 5d59a34340b..c9ff665bebe 100644 --- a/shippable.yml +++ b/shippable.yml @@ -38,11 +38,12 @@ build: - mix --version # test samples defined in pom.xml - mvn --quiet verify -P samples.shippable -Dmaven.javadoc.skip=true - # generate all petstore samples (client, servers, doc) - - ./bin/run-all-petstore - # generate all petstore samples (openapi3) - - ./bin/openapi3/run-all-petstore - # generate test scripts - - ./bin/tests/run-all-test - # test all generators with fake petstore spec (2.0, 3.0) - - ./bin/utils/test-fake-petstore-for-all.sh + # below moved to CircleCI + ## generate all petstore samples (client, servers, doc) + #- ./bin/run-all-petstore + ## generate all petstore samples (openapi3) + #- ./bin/openapi3/run-all-petstore + ## generate test scripts + #- ./bin/tests/run-all-test + ## test all generators with fake petstore spec (2.0, 3.0) + #- ./bin/utils/test-fake-petstore-for-all.sh diff --git a/website/dynamic/team.yml b/website/dynamic/team.yml index 9ddd77b78cc..a72bfae3409 100644 --- a/website/dynamic/team.yml +++ b/website/dynamic/team.yml @@ -12,9 +12,9 @@ core: - name: Akihito Nakano github: ackintosh joined: 2018/02 - - name: Jean-François Côté - github: JFCote - joined: 2018/03 - name: Jérémie Bresson github: jmini joined: 2018/04 + - name: sunn + github: etherealjoy + joined: 2019/06